<?php namespace App\Models;
use CodeIgniter\Database\ConnectionInterface;
use CodeIgniter\Model;


class Setupmodel extends Model 
{
 protected $table      = 'admin';
 protected $primaryKey = 'Id';
 protected $allowedFields = ['Name', 'Password','Role'];   





public function adminUser($Name,$Password,$Role)

{

$data = [
		'Name' => $Name,
		'Password'    => $Password,
		'Role'=> $Role
	];

	$this->save($data);




	
}









public function index()
{
$db = \Config\Database::connect("default");
		
$query = $db->query("SELECT * FROM blog");
$row   = $query->getRowArray();
return  $row['title'].$row['article'];

	
}







public function insertData($title,$article)
{
	$db = \Config\Database::connect("default");
echo 	$title;
echo 	$article;
	
	
	
	
	
    $sql = "INSERT INTO blog ( title,article) VALUES ('.$title.','.$article.')";
$db->query($sql);

}


}
