Monday, March 6, 2017

Search Methode Controller in Laravel

i get no result with the function to get the clubs from a search Form in a view .

Here my "Search" controller

    public function getClubs(Request $request){

        if($request->has('recherche')){

            $clubs = Structure::where('nom_structure' , 'LIKE', '%'. $request .'%')->where('type_structure_id' , '=' , 4)->get();



        }else{
            $clubs = Structure::where('type_structure_id' , 4)->paginate(10);
        }

        dd($clubs);

        return view('structure/clubs' , compact('clubs'));

    }

I tried to tape the exact name of a club but still no result , someone have an idea to get a search methode who works ? thanks in advance



via Mathieu Mourareau

Advertisement