latest or oldest
amin101 opened this issue · comments
amin commented
I'm a bit confused by using latest
and oldest
methods in same query . would you please explain this :
public function index($n)
{
return $this->model
->with('post', 'user')
->oldest('seen')
->latest()
->paginate($n);
}
bestmomo commented
Because there are 2 orders, look at queries :
select count(*) as aggregate from `comments`
select * from `comments` order by `seen` asc, `created_at` desc limit 4 offset 0
select * from `posts` where `posts`.`id` in ('1', '2')
select * from `users` where `users`.`id` in ('2', '3')
select * from `users` where `users`.`id` = '1' limit 1