I am trying to use a simple query with laravel but its not returning any data. but when I run same query in phpmyadmin it returns 3 rows.
This is code in laravel.
$pages = DB::table('static_pages')
->where('slug','=','(select slug from static_pages where id='.$id.')')
->get();
this is the query it makes.
select * from `static_pages` where `slug` = (select slug from static_pages where id=2)
Can you tell me what could be the reason?
php artisan make:model StaticPageand it will be inapp\StaticPagelinked tostatic_pagestable the you can access it likeStaticPage::where(...)->get()and it's very easy to use instead of usingDB