Can you wrap all the code inside backticks please ?
Route [] not defined. (Symfony \ Component \ Routing \ Exception \ RouteNotFoundException)
I've searched every crack and crevice of the internet and EVERY post with the "Route[] not defined" to simply understand why this is taking place but nothing has solved it.
I have a laravel project(app/website) that needed a login system. I tried making another separate new app with breeze just to copy everything from it . The following works exactly well on Breeze app but not on my main project app. The problem is when I try to login and I'm supposed to rerouted to the home route service provider but I get an exception. My ProfileController has these three methods. (Literally just renamed them from the basic mehods of breeze; they're even working in the breeze app):
public function loginPage()
{
return view('Main.auth.login');
}
//Handle an incoming authentication request.
public function login(LoginRequest $request)
{
$request->authenticate();
$request->session()->regenerate();
return redirect()->intended(RouteServiceProvider::HOME);
}
//Destroy an authenticated session.
public function logout(Request $request)
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/');
}
Here're the auth route:
```Route::middleware('guest')->group(function () {
Route::get('register', [ProfileController::class, 'create'])->name('register');
Route::post('register', [ProfileController::class, 'store']);
Route::get('login', [ProfileController::class, 'loginPage'])->name('login');
Route::post('login', [ProfileController::class, 'login']);
Route::get('forgot-password', [ProfileController::class, 'passwordForgotPage'])->name('password.request');
Route::post('forgot-password', [ProfileController::class, 'passwordReset'])->name('password.email');
Route::get('reset-password/{token}', [ProfileController::class, 'passwordResetPage'])->name('password.reset');
Route::post('reset-password', [ProfileController::class, 'passwordResetUpdate'])->name('password.store');
});
Route::middleware('auth')->group(function () {
Route::get('verify-email', [ProfileController::class, 'emailVerificationLinkPage'])->name('verification.notice');
Route::post('email/verification-notification', [ProfileController::class, 'emailVerificationLink'])->middleware('throttle:6,1')->name('verification.send');
Route::get('verify-email/{id}/{hash}', [ProfileController::class, 'emailVerification'])->middleware(['signed', 'throttle:6,1'])->name('verification.verify');
Route::get('confirm-password', [ProfileController::class, 'confirmPasswordPage'])->name('password.confirm');
Route::post('confirm-password', [ProfileController::class, 'confirmPassword']);
Route::put('password', [ProfileController::class, 'passwordUpdate'])->name('password.update');
Route::post('logout', [ProfileController::class, 'logout'])->name('logout');
Route::get('/dashboard', function () {
return view('dashboard');
})->middleware(['verified','password.confirm'])->name('dashboard');
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});
My Authenticated middleware:
``` protected function redirectTo($request)
{
$host=request()->getHttpHost();
$domain = new Domain($host);
$domainconfirmerparameter = $domain->getName();
$currentSiteName=Site::where('oneword','=',$domainconfirmerparameter)->first();
if (! $request->expectsJson()) {
if ($domain->getSub() === 'panel')
{
return route('admin.login');
}
else
{
return route('login');
}
}
}
I have cache clear and optimized every option on php artisan and nothing is working. I can't help but feel something was missing when I installed laravel.
My last hope is to carry everything from my main app on to the breeze, instead of the logical way...
Please or to participate in this conversation.