Welcome Guest, Not a member yet? Register   Sign In
Pagination
#1

(This post was last modified: 03-25-2022, 07:42 PM by Z4K7.)

Hello I hope you can help me I try to make a pagination with CI4 but I have not succeeded



At the time of consulting the DB, only specific profiles are requested, which is number 3



Model



PHP Code:
public function getAll$start 0$limit 0,$role_id '3')
 {
 return 
$this->users_query($start$limit,$role_id)->getResultArray();
 }

 public function 
users_query($start 0$limit 0$role_id '3')
 {
 
$builder $this->db->table('usuarios');
 
$builder->select('usuarios. id,usuario,email,Admission_date,update_date,unique_id,last_login, grupos_perfiles.id_perfil,perfiles.name');
 
$builder->limit(100);
 
$builder->orderBy('id''asc');
 
$builder->join(
 
'grupos_perfiles',
 
'grupos_perfiles.user_id=usuarios.id',
 );
 
$builder->join(
 
'perfiles',
 
'perfiles.id=grupos_perfiles.id_perfil',
 );
 
$builder->where('grupos_perfiles.id_perfil'$role_id);
        

        
if (!empty($limit) || !empty($start)) {
 
$builder->limit($limit$start);
 }
 return 
$builder->get();
 } 


Controller



When I do pager to get it out it doesn't work it throws me an error.


ErrorException

Trying to get property 'page' of non-object

PHP Code:
public function index()
    {
 
$pager = \Config\Services::pager();
 
$model = new \App\Models\pagination();
      $cliente $model->getAll(0,5);
 return 
view('admin/clientes/cliente',[
            'admi' => $cliente,
 
'page' => $cliente->pager,

        ]);

    
Reply


Messages In This Thread
Pagination - by Z4K7 - 03-25-2022, 03:38 PM
RE: Pagination - by ignitedcms - 03-25-2022, 05:28 PM
RE: Pagination - by luckmoshy - 03-25-2022, 09:58 PM
RE: Pagination - by Z4K7 - 03-26-2022, 11:39 AM
RE: Pagination - by InsiteFX - 03-27-2022, 12:30 AM
RE: Pagination - by Z4K7 - 03-27-2022, 07:38 PM
RE: Pagination - by InsiteFX - 03-28-2022, 12:23 AM
RE: Pagination - by Z4K7 - 03-28-2022, 08:18 AM
RE: Pagination - by ignitedcms - 03-28-2022, 06:21 AM
RE: Pagination - by ignitedcms - 03-28-2022, 09:05 AM
RE: Pagination - by Z4K7 - 03-28-2022, 11:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB