Laravel - Query Builder - Determining If Records Exist

Instead of using the count method to determine if any records exist that match your query's constraints, you may use the exists and doesntExist methods:

    
    if (DB::table('orders')->where('finalized', 1)->exists()) {
        // ...
    }
    
    if (DB::table('orders')->where('finalized', 1)->doesntExist()) {
        // ...
    }