In this tutorial, we will learn about exists query or doesntExists query in laravel application. 

exists() query used to any rows exist for the current query and doesntExist() query used to no rows exist for the current query.

Given below are examples for exists query or doesntExists query in laravel application. 



Example 1

* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    return DB::table('users')->where('is_active', 1)->exists();
}



Example 2

/**
* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    return DB::table('users')->where('is_active', 1)->doesntExist();
}


I hope this example helps you.