how condition for multiple row by orwhere laravel

Solutions on MaxInterview for how condition for multiple row by orwhere laravel by the best coders in the world

showing results for - "how condition for multiple row by orwhere laravel"
Isabel
11 Jul 2019
1  public function index()
2    {
3        $search = "Har";
4  
5        $users = User::select("*")->where('status', 1)
6                  ->where(function($query) use ($search){
7                   $query->where('first_name', 'LIKE', '%'.$search.'%')
8                   ->orWhere('last_name', 'LIKE', '%'.$search.'%')
9                   ->orWhere('email', 'LIKE', '%'.$search.'%');
10                    })->get();
11  
12        dd($users);
13    }
14
15# With Join
16  public function index()
17    {
18        $search = "Har";
19  
20        $users = User::select("*")->where('status', 1)
21                  ->where(function($query) use ($search){
22                   $query->where('first_name', 'LIKE', '%'.$search.'%')
23                   ->orWhere('last_name', 'LIKE', '%'.$search.'%')
24                   ->orWhere('email', 'LIKE', '%'.$search.'%');
25                    })
26          ->join('users_roles', 'users.id', '=', 'users_roles.user_id')
27          ->where('users_roles.role_id', '=', Role::USER_PARTICIPANT)->get();
28  
29        dd($users);
30    }
Pia
04 May 2017
1if ($request->search) {
2             
3     $users = User::where('type', '=',  'Customer')
4        ->where(function ($query) use ($request) {
5            $query->where('name', "like", "%" . $request->search . "%");
6            $query->orWhere('mobile', "like", "%" . $request->search . "%");
7        })->get();   
8  }
9
queries leading to this page
laravel multiple orwhere and and not workinglaravel multiple where whenlaravel where multiple conditionsmultiple where clause laravel in one wherehow to write multiple conditions in where clause laravelmultiple where and orwhere in laravel2 conditions in where laravellaravel 7 orwhere with multiple conditionsorwhere multiple where laraveltwo where condition in laravelmultiple when condition laravellaravel orwhere multiplemultiple orwhere condition in laravellaravel where multiple valueseloquent where with multiple conditionsmultiple where condition in eloquentlaravel where or multiplemultiple where condition using if in laravellaravel eloquent multiple where conditioneloquent multiple orwheremultiple where clause in laravel eloquentwhere 2 condition laravellaravel eloquent multiple where and orwherelaravel firstwhere multiple conditionslaravel multiple with use to where has query unmultiple where laravel 8laravel multiple where and orwherewhere multiple conditions sql laravelinside where using 2 condition i laravel multiple orwhere in laravelmultiple where condition in where clause in laravelmultiple where clause laravelhow to to apply multiple where condition in laravellaravel multiple where conditionlaravel query multiple rowseloquent multiples where and orwherelaravel two where conditions 23multiple where condition in laravel 8laravel have two where conditionsmultiple 26 26 in laravel eloquentlaravel sql where row 2 conditions on same columnmore than 2 where conditions in laraveleloquent where multiple or conditionsmultiple where and wherein laravellaravel where with or conditionmultiple where statements in laravelhow to get rows of multiple condition laravel mysqllaravel more than one where conditionlaravel multiple condition on joinlaravel where multiple conditions orlaravel multiple with functionlaravel multiple statementsmultiple where conditions elequentorwhere multiple laravelhow to use orwhere in laravel with multiple where conditionmultiple where condition in laravel query builderhow condition for multiple row by orwhere laravellaravel multiple orwherehow to use two where condition in one statement in laravellaravel query multiple conditionscheck multiple conditions in where clause laravel ormmultiple where condition laravellaravel eloquent multiple orwheremultiple orwheres laravelhow to select multiple where conditions in laravel sql querymultiple orwhere laravellaravel multiple or condition inside wherelaravel multiple where andlaravel mysql orwheremultiple and wherein laravellaravel eloquent where with two conditionmultiple condition where laravel 7multiple or where laravellaravel multiple wherein multiple where clause in select laravelmultiple orwhere laravel codeignitermultiple where inside where or laraveltwo where but or condition in laravellaravel multiple where and ormultiple andwhereins laravelorwhere condition in laravellaravel query builder multiple orwhereorwhere multiple value laravelmultiple condition in laravel wheremultiple where in laravellaravel where with multiple conditionsmultiple where condition in laravelmultiple where laravel andwhereuse multiple where clause and not in condition in laravelmultiple where condition in laravel orwherewhere with two conditions laravellaravel where and clause with multiple conditionsmulti orwhere laravelmultiple where and andwherein laravel select with multiple where clause in laravelorwhere multiple conditions laravelmultiple where clause in laravellaravel where with two conditionshow check two condition in where in laravel2 where condition in laravel 1 orwherelaravel orwhere with multiple wherelaravel more than two where conditionlaravel firstwhere multiple and conditionslaravel multiple where clausemultiple conditions laravel querytwo condition in one laravel querylaravel multiple canmultiple conditions in where laravellaravel multiple wheremore than one condition in where laravel laravel when condition multiple two where condition with and in laravelmultiple conditions in laravel whereorwhere laravel two conditionsmultiple where condition eloquent querylaravel when for two where clauselaravel where or where multiplemultiple where condition in laravel using loopuse multiple conditions in one where clause laravel eloquentlaravel model multiple where and orwhereorwhere with more conditions laravelmultiple tables where in laravellaravel multiple wherein columnslaravel orwhere conditionlaravel multiple relationships with conditionmultiple where clause in laravel modellaravel 2 condition in a wherewhere clause for multiple value in laravellaravel query builder select multiple rows where conditionslaravel multiple or wherequery where with two conditions laravelmultiple wheres laravellaravel where and or conditionmultiple where condition in laravel eloquentlaravel 8 where or multiple conditionlaravel query with multiple orwhereusing multiple where in laravelhow to retrieve multiple row with multiple conditions in a single query in laravelmultiple value in where clause laravellaravel eloquent two orwhere clauseslaravel wherein multiple columnswhere condition eloquent multiplemultiple where condition in laravel as arraylaravel mysql how to use clause where for multiple checkmultiple where clause in laravel 8how to write two where condition in laravelhow condition for multiple row by orwhere laravel