php - Laravel 5.2 Missing required parameters for [Route: user.profile] [URI: user/{nickname}/profile] -
i keep getting error
errorexception in urlgenerationexception.php line 17:
when ever page loads , i'm logged in.
here nav looks like
@if(auth::guest()) <li><a href="{{ url('/login') }}">log in</a></li> <li><a href="{{ url('/register') }}">sign up</a></li> @else <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ auth::user()->nickname }}<span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="{{ route('user.profile') }}">profile</a></li> <li><a href="{{ route('user.settings') }}">settings</a></li> <li><a href="{{ url('/logout') }}">log out</a></li> </ul> </li> @endif
the problem i'm having {{ route('user.profile') }} not working??
when hit link www.mydomain.com/user/scratk/profile works fine page wont load becuase of error??
missing required parameters [route: user.profile] [uri: user/{nickname}/profile].
this routes file
route::group(['middleware' => 'web'], function () { route::auth(); route::get('/', ['as' => 'home', 'uses' => 'basecontroller@index']); route::group(['namespace' => 'user', 'prefix' => 'user'], function(){ route::get('{nickname}/settings', ['as' => 'user.settings', 'uses' => 'settingscontroller@index']); route::get('{nickname}/profile', ['as' => 'user.profile', 'uses' => 'profilecontroller@index']); }); });
you have pass route parameters route
method, example:
<li><a href="{{ route('user.profile', $nickname) }}">profile</a></li> <li><a href="{{ route('user.settings', $nickname) }}">settings</a></li>
it's because, both routes have {nickname}
in route declaration. i've used $nickname
example make sure change $nickname
appropriate value/variable, example, following:
<li><a href="{{ route('user.settings', auth()->user()->nickname) }}">settings</a></li>
Comments
Post a Comment