Laravel Query Builder Where Exists Example

Today now on this post i will show you laravel query builder where exists example. When we are use sql where exists clause in laravel. And whereExists through we can use sql where exists clause in our laravel project. So It is very easy to use and we can easily understand. we can give SELECT statement in where condition. we can see the bellow example and we can learn how to use whereExists in our application.

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 =');

Read Also :Laravel Join with Subquery in Query Builder Example

Thanks for read. I hope it help you. For more you can follow us on facebook.


About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →