vendredi 26 novembre 2021

real-time data finder - search with multiple models

i need to make my search engine work with multiple data tables

right now get data from the model "Registro".

    public function buscador(){
        
        return view('posts.index');
        
    }
        public function search(Request $request){
            
            $results = Registro::where('cliente', 'LIKE', "%{$request->search}%")->get();
            
            return view('posts.results', compact('results'))->with(['search' => $request->search])->render();
            
        }
        public function show(Request $request){
            
            $post = Registro::findOrFail($request->id);
            return view('posts.post', compact('post'))->render();
            
       
    
}

can search with multiple models?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire