SELECT b.cat_id, b.cat_parent FROM cat AS b LEFT JOIN cat AS a ON b.cat_parent = a.cat_id WHERE b.cat_title = 'Sail' AND b.cat_place_id =4607 AND a.cat_title = 'Garden and plants'
When I write this query in phpmyadmin or in mysqlworkbench i it's all ok But when I write this query in laravel, I get empty array
DB::table('cat AS b') ->leftJoin('cat AS a', 'b.cat_parent', '=', 'a.cat_id') ->where('b.cat_title', '=', $info['filter']) ->where('b.cat_place_id', '=', $info['place']) ->where('a.cat_title', '=', $info['subchapters']) ->get(array('b.cat_id', 'b.cat_parent'));
How can I solve this problem?
I am not very sure if this works:
DB::table('cat AS b')
Can you please try executing the query without the aliases and see the result ?
Also, please mark up your post, it's easier to read. There is a link at the bottom of the thread "Learn how to mark up your post here"
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community