• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Pagination

#1
Heart 
Using this method the pagination is working fine! But how can I filter the data? For example I'm logged with user id: 1 and I want to see only companies that belongs to this user.

Using the instance like this I'll always get all the rows of this table =/

public function list(){
        $companyModel = new CompanyModel();
        
        $data = [
            'obj' => $companyModel->paginate(20, 'group1'),
            'pager' => $companyModel->pager
        ];
        
        echo view('Template/header');
        echo view('Company/listar', $data);
        echo view('Template/footer');
 }
Reply

#2
Code:
$companyModel
    ->where('user_id', 1)
    ->paginate(20, 'group1'),
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#3
Thank you a lot [b]kilishan[/b]!!!!

This works!
Code:
$companyModel
   ->where('user_id', 1)
   ->paginate(20, 'group1'),

This DONT work
Code:
$companyModel
   ->paginate(20, 'group1'),
   ->where('user_id', 1)

Pay attention in the order when creating a pagination guys!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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