📜  如何通过 orwhere laravel 获得多行条件 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:16.953000             🧑  作者: Mango

代码示例1
if ($request->search) {
             
     $users = User::where('type', '=',  'Customer')
        ->where(function ($query) use ($request) {
            $query->where('name', "like", "%" . $request->search . "%");
            $query->orWhere('mobile', "like", "%" . $request->search . "%");
        })->get();   
  }