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

Route are not defined (Custom function inside Resources Controller) – Laravel

I have checkIn function in LoginController:

LoginController.php with Path :

Controllers/Backsite/LoginController

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

    public function checkIn(Request $request, User $user)
        { 
           ...
        }

Already defined them in web.php

Route::group(['prefix' => 'backsite', 'as' => 'backsite.', 'middleware' => ['auth:sanctum', 'verified']], function(){
   Route::get('/login/checkIn', [LoginController::class, 'checkIn']);
});

I call them from button in blade.php by using:

<button type="button" class="btn btn-primary btn-min-width mr-1 mb-1" href={{ route('backsite.login.checkIn') }}>CheckIn</button>
<button type="button" class="btn btn-info btn-min-width mr-1 mb-1" href={{ route('backsite.login.checkOut') }}>CheckOut</button>

But I shows me error that

Route [backsite.login.checkIn] not defined.

Im using Laravel 8, and already tried any other I found in Stackoverflow but still giving me Error

>Solution :

"Route not defined error" occur when you are trying to use route which is not defined please updated your code and defined route in path.

    Route::group(['prefix' => 'backsite', 'as' => 'backsite.', 'middleware' => ['auth:sanctum', 'verified']], function(){
   Route::get('/login/checkIn', [LoginController::class, 'checkIn'])->name('login.checkIn');
});
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