Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel query when

$users = DB::table('users')
                ->when($role, function ($query, $role) {
                    $query->where('role_id', $role);
                })
                ->get();
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #query
ADD COMMENT
Topic
Name
9+1 =