Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Laravel route setting incorret and search function issues

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'));
    }

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading