s0hno s0hno - 1 year ago 168
PHP Question

Laravel paginate order by

What should I do to pass the values ‚Äč‚Äčthat you order by in patinate?


$ondata = DB::table('official_news') -> orderBy('created_date', 'desc') -> get() -> paginate(7);
return View::make('main',array('ondata' => $ondata));


Call to a member function paginate() on a non-object

I need your help

Answer Source

This should do the trick:

$ondata = DB::table('official_news')->orderBy('created_date', 'desc')->paginate(7);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download