I have used whereOr
and orWhere
in my code in Laravel both works but at times gives different result
$user_query = User::select( 'users.id', 'users.username','users.first_name','users.last_name', 'users.photo' )
->where('users.status',1)
->where('users.id','!=',$id)
->where('users.username','like','%'.$searchkey.'%')
->orWhere('users.first_name','like','%'.$searchkey.'%')
->orwhere('users.last_name','like','%'.$searchkey.'%')->get();
// ->whereOr('users.first_name','like','%'.$searchkey.'%')
// ->whereOr('users.last_name','like','%'.$searchkey.'%')->get();
What's the difference between whereOr
and orWhere
whereOr
? – Ranson