Answers for "add clause laravel"

PHP
0

laravel where and where

Table::where('Column', Value)->where('NewColumn', Value)->get();
Posted by: Guest on September-04-2020
0

when in larevel

$role = $request->input('role');

$users = DB::table('users')
                ->when($role, function ($query, $role) {
                    return $query->where('role_id', $role);
                })
                ->get();
Posted by: Guest on September-14-2020

Browse Popular Code Answers by Language