Mehrer Suchfilter in Laravel

public function index(Request $request)
    {
        $search =  $request->input('q');
        if($search!=""){
            $Members = Member::where(function ($query) use ($search){
                $query->where('name', 'like', '%'.$search.'%')
                    ->orWhere('email', 'like', '%'.$search.'%');
            })
            ->paginate(2);
            $Members->appends(['q' => $search]);
        }
        else{
            $Members = Member::paginate(2);
        }
        return View('pages.search')->with('data',$Members);
        //
    }
Precious Peacock