4
I have the following function inside the controller
public function home()
{
$igrejas = Igreja::paginate(3);
$igrejas->setPath('igrejas');
return view('admin/igrejas/home')->with('igrejas', $igrejas);
}
I need it to be returned beyond pagination, by order of creation, that the last records appear on the first page. As it stands the system brings in the last pages the last records, I need the reverse.
If you have a data_register column with default now() you can sort by this column using the Miguel method below, but by changing the column value.
– Diego Souza
Exactly @Peterparker, this will even give the same if there is a column with auto-increment (as is the case with the id by convention). It is automatically ordered by creation
– Miguel