• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
custom seacrh function in model

#1
Exclamation 
Hello,
I'm new on CI4 and i like to create advanced search form for list clients by email,name and other data..
I have the userModel:

namespace App\Models;
use CodeIgniter\Database\ConnectionInterface;
use CodeIgniter\Model;

class UserModel extends Model
{

    protected $table = 'users';
protected $primaryKey = 'id';
    protected $allowedFields = ['role', 'email','password','display_name','banned','active','expired_at','token','partner'];

protected $returnType = 'array';

protected function search($role=null,$display_name=null,$email=null){
/** find data related to variables **/
}
}


How must do on function search to get result? ( not required all search fields are filled!)

Thanks..
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.