Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

search in laravel 8

public function index(){
      // // we need to show all data from "blog" table
      // $blogs = Blog::all();
      // // show data to our view
      // return view('blog.index',['blogs' => $blogs]);

      $search = Request::get('search');
      $blogs = Blog::where('title','like','%'.$search.'%')->orderBy('id')->paginate(6);
      return view('blog.index',['blogs' => $blogs]);
    }
 
PREVIOUS NEXT
Tagged: #search #laravel
ADD COMMENT
Topic
Name
3+3 =