Welcome Guest, Not a member yet? Register   Sign In
Pagination with Custom model
#6

This is how I am doing and working perfectly 

Code:
public function index($keyword = null)
    {
        $keyword = trim($this->request->getVar('keyword'));
        $Product = new Product();
        $data['title'] = 'All Products';
        $data['products'] = $Product->like('name',$keyword)
                            ->orderBy('created_at','DESC')
                            ->paginate(15);
        $data['pager'] = $Product->pager;
        $data['currentPage'] = $Product->pager->getCurrentPage('default'); // The current page number
        $data['totalPages']  = $Product->pager->getPageCount('default');  // The total page count
        return view('Travo\Admin\Views\Products\Index', $data);
    }
Reply


Messages In This Thread
Pagination with Custom model - by AndreaL - 12-31-2020, 03:59 AM
RE: Pagination with Custom model - by InsiteFX - 12-31-2020, 12:27 PM
RE: Pagination with Custom model - by AndreaL - 01-04-2021, 03:03 AM
RE: Pagination with Custom model - by seunex - 01-04-2021, 04:01 AM
RE: Pagination with Custom model - by includebeer - 01-04-2021, 05:33 AM
RE: Pagination with Custom model - by AndreaL - 01-07-2021, 02:31 AM
RE: Pagination with Custom model - by rmcdahal - 01-04-2021, 06:29 AM
RE: Pagination with Custom model - by includebeer - 01-07-2021, 08:19 AM
RE: Pagination with Custom model - by AndreaL - 02-09-2021, 03:41 AM
RE: Pagination with Custom model - by MuhAnhar - 01-12-2021, 06:06 AM
RE: Pagination with Custom model - by includebeer - 01-12-2021, 03:46 PM
RE: Pagination with Custom model - by InsiteFX - 02-09-2021, 07:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB