Level 4
Nevermind, I figured it out.
$beers = Beer::orderBy('created_at', 'desc')->paginate(9);
2 likes
How can I reverse this collection? Simply using the reverse function does not seem to work here.
public function index()
{
// get all beers and paginate them
$beers = Beer::paginate(9);
return view('beers.index', compact('beers'));
}
Nevermind, I figured it out.
$beers = Beer::orderBy('created_at', 'desc')->paginate(9);
Please or to participate in this conversation.