I have a checkIn function in LoginController:
The path ofLoginController.php is: Controllers/Backsite/LoginController
public function checkIn(Request $request, User $user) { ... }
I have 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 by using the following code in blade.php:
<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 it shows an error of Route [backsite.login.checkIn] not defined
.
I'm using Laravel 8 and have tried other methods found on Stackoverflow but still getting the error.
P粉6931261152023-09-11 00:37:31
"Undefined route error" occurs when you try to use an undefined route, please update your code and define the route in the path.
Route::group(['prefix' => 'backsite', 'as' => 'backsite.', 'middleware' => ['auth:sanctum', 'verified']], function(){ Route::get('/login/checkIn', [LoginController::class, 'checkIn'])->name('login.checkIn'); });