5

when I execute this code in Laravel 7.2.0

$news = NewsPost::select('title','slug','category_id', 'image', 'fulltext', 'created_at')->with('category:id,title,slug')->orderBy('created_at', 'desc')->simplePaginate(10);

I have 3 query on the page

select `title`, `slug`, `category_id`, `image`, `fulltext`, `created_at` from `news_posts` where `news_posts`.`deleted_at` is null order by `created_at` desc limit 11 offset 0
select `id`, `title`, `slug` from `news_categories` where `news_categories`.`id` in (2, 4)
select * from `news_categories` where 0 = 1

I cannot understand what is the purpose of last query and what means where 0 = 1

schel4ok
  • 634
  • 1
  • 11
  • 33

0 Answers0