When the user clicks on profile link:
<li>
<a href="{!! route('user.show', Auth::user()->username) !!}">My Profile</a>
</li>
The UserController@show method is called.
<?php
// routes.php
Route::get('profile/{username}', 'UserController@show')->name('user.show');
// UserController.php
public function show($username)
{
$user = User::whereUsername($username)->first();
return view('user.show', compact('user'));
}
and a View response is returned to the user.
@update
If you need is just redirect the control to the UserController@show method, you can do this:
<li>
<a href="{!! route('user.profile', Auth::user()->username) !!}">My Profile</a>
</li>
<?php
// routes.php
Route::get('profile/{username}', function ($username) {
return redirect()->route('user.show', Auth::id());
})->name('user.profile');
Now if you want customize the UserController@show action:
<li>
<a href="{!! route('user.profile', Auth::user()->username) !!}">My Profile</a>
</li>
The UserController@show method is called.
<?php
// routes.php
Route::resource('user', 'UserController', ['except' => ['show']);
Route::get('profile/{username}', 'UserController@profile')->name('user.profile');
Now you can delete the UserController@show method if you want or change the profile method name to show.
// UserController.php
public function profile($username)
{
$user = User::whereUsername($username)->first();
return view('user.show', compact('user'));
}