Quantcast
Viewing all articles
Browse latest Browse all 14

Answer by Vladimir Salguero for Laravel Eloquent "WHERE NOT IN"

I had problems making a sub query until I added the method ->toArray() to the result, I hope it helps more than one since I had a good time looking for the solution.

Example

DB::table('user')                   ->select('id','name')  ->whereNotIn('id', DB::table('curses')->select('id_user')->where('id_user', '=', $id)->get()->toArray())  ->get();

Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>