Laravel 5 query builder where exists example

By Hardik Savani | March 7, 2016 | | 45787 Viewer | Category : PHP Laravel MySql

you use sql where exists clause in laravel. whereExists through you can use sql where exists clause in your laravel project. It is very easy to use and you can easily undestand. You can give SELECT statment in where condition. you can see bellow example and you can learn how to use whereExists in your app.

SQL Query


FROM `items`


(SELECT `items_city`.`id`

FROM `items_city`

WHERE items_city.item_id =

Using Laravel Query Builder


->whereExists(function ($query) {



->whereRaw('items_city.item_id =');



***Do you want me hire for your Project Work? Then Contact US.