Home > Back-end >  Route not found even though It's defined
Route not found even though It's defined

Time:04-07

This is the error that I get rolled out (View: Route [user.profile] not defined. (View: D:\Programi\XAMPP\htdocs\crushapp\resources\views\layouts\base.blade.php)

But my route is clearly defined here:

use App\Http\Livewire\User\ProfileComponent;
Route::middleware(['auth:sanctum','verified'])->group(function()
{
    Route::get('/user/profile',ProfileComponent::class)->name('user.profile');
    
});

The error comes from the layout, namely:

<span><i  aria-hidden="true"></i> <a href="{{ route('user.profile') }}">{{ Auth::user()->name }}  ‎‎‏‏‎ ‎‎‏‏</a></span>

Any ideas what could it be?

UPDATE: Any new route I try defining under user won't work...

CodePudding user response:

first you are missing a function name in your route also run php artisan route:clear

Route::get('/user/profile',ProfileComponent::class, 'index')->name('user.profile')
  • Related