latest()is a function defined in a class Illuminate\Database\Query\Builder. It is very simple. Here is how it is defined.
public function latest($column = 'created_at')
{
return $this->orderBy($column, 'desc');
}
So, it will be just orderBywith the column that you specify in descendingorder, the default column will be created_at.
source
share