Php Laravel 4用户配置文件链接
我目前有一条如下所示的路线:Php Laravel 4用户配置文件链接,php,laravel,laravel-4,Php,Laravel,Laravel 4,我目前有一条如下所示的路线: Route::get('/profile/{username}',array( 'as' => 'profile', 'uses' => 'ProfileController@getProfile' )); 这个想法是一个链接,比如http://www.website-here.com/profile/johnnyappleseed包含用户名的将在数据库中搜索用户名,并返回基于URL中用户名匹配的配置文件。如何使用相同的路由创建登录用户
Route::get('/profile/{username}',array(
'as' => 'profile',
'uses' => 'ProfileController@getProfile'
));
这个想法是一个链接,比如http://www.website-here.com/profile/johnnyappleseed包含用户名的
将在数据库中搜索用户名,并返回基于URL中用户名匹配的配置文件。如何使用相同的路由创建登录用户配置文件的链接。目前我有
但这似乎是不正确的,应该有一种方法可以使用一些Laravels帮助器来实现这一点。您可以使用帮助器并传递路由名称和所需的参数数组:
<li>
<a href="{{ route('profile', [Auth::user()->username]) }}">
Profile
</a>
</li>
<li>
{{ HTML::link(route('profile', [Auth::user()->username]), 'Profile') }}
<li>