Welcome Guest, Not a member yet? Register   Sign In
Upgrade Model CI3 to CI4
#3

Just a Model sample
PHP Code:
<?php

namespace App\Models;

use 
CodeIgniter\Model;

class 
SampleModel extends Model
{
    protected $table  'yourtable';
    protected $primaryKey 'id';
        
    
protected $allowedFields = ['status''name']; // just an example

    public function sample()
    {
        $db $this->db;
        $query $db->table('yourtable')
        ->select('id, name')
        ->where('status'1)
        ...
      ->get();
      
      
return $query->getResult(); 
      
    
}

Reply


Messages In This Thread
Upgrade Model CI3 to CI4 - by cloude - 02-14-2021, 04:39 AM
RE: Upgrade Model CI3 to CI4 - by iRedds - 02-14-2021, 09:32 AM
RE: Upgrade Model CI3 to CI4 - by wdeda - 02-14-2021, 09:43 AM
RE: Upgrade Model CI3 to CI4 - by Chivinsdev - 02-16-2021, 01:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB