This function search user from MySQL. Can anyone knows which part I did wrong ?, searchUser
function is not triggered.
admin view
<form type="get" action="role-permission-search">
<input type="search" class="" name="query" placeholder="Search"/>
<button type="button" class="btn btn-outline-primary">search</button>
</form>
Route::group(['prefix'=>'admin', 'middleware'=>['isAdmin','auth']], function(){
// Serch users
Route::get('role-permission-search', [AdminController::class, 'searchUsers']);
});
function searchUsers()
{
dd('Where are you');
$search_request = $_GET['query'];
$users = User::where('name', 'LIKE', '%'.$search_request.'%')-get();
return view('dashboards.admins.rolePermission', compact('users'));
}
CodePudding user response:
You can remove type="button" from below line
<button type="button" class="btn btn-outline-primary">search</button>
or change type="submit"
If still that not works for you then you should defile action="{{ route('YOUR ROUTE NAME') }}" in tag