2021年4月4日星期日

search keyword in table list

I want to search keyword base on the word on table but when I search there is no output and no error display but the url display the keyword for example http://127.0.0.1:8000/users?keyword=sulaimani

Index.blade.php

<form action="" method="GET">      <input type="text" name="keyword" class="form-control" placeholder="Search for...">            <button type="submit" class="btn btn-info">               <i class="fa fa-search"></i> Search            </button>  </form>  

UserController.php

public function search(Request $request)  {      $keyword = $request->get('keyword');      $users = User::where('name', 'LIKE', '%' . $keyword . '%')->orwhere('email', 'LIKE', '%' . $keyword . '%')->paginate(4);       return view('users.index')->with(compact('users'));  }  

web.php

Route::get('user/search', 'UserController@search')->name('users.search');  
https://stackoverflow.com/questions/66947924/search-keyword-in-table-list April 05, 2021 at 11:31AM

没有评论:

发表评论