Laravel 5.8 路由问题
Laravel 5.8 routing issue
我刚刚安装了 Laravel 5.8,但遇到路由问题,我无法提供 URL 并随意命名。
Route::get('profile/my-profile', [
'uses' => 'ProfileController@profile',
'as' => 'profile'
]);
我试过上面的方法,结果是我这样写的时候,在浏览器中没有显示我的头像。它只显示我的名字,但是当我像下面这样写时,就可以了。
Route::get('profile', [
'uses' => 'ProfileController@profile',
'as' => 'profile'
]);
这工作正常....
{{ asset(Auth::user()->profile_picture) }}
我用的是这种路由,没问题,没有报错
http://yoursite.com/profile/myprofile
Route::group(['prefix' => 'profile'], function (){
Route::get('/myprofile', [
'uses' => 'ProfileController@profile',
'as' => 'pages.profile'
]);
});
or:
http://yoursite.com/myprofile
Route::get('/myprofile', [
'uses' => 'ProfileController@profile',
'as' => 'pages.profile'
]);
{{ route('pages.profile') }}
对于要附加的图像或任何文件,请使用此代码:
{{ URL::to('your file path') }}
我刚刚安装了 Laravel 5.8,但遇到路由问题,我无法提供 URL 并随意命名。
Route::get('profile/my-profile', [
'uses' => 'ProfileController@profile',
'as' => 'profile'
]);
我试过上面的方法,结果是我这样写的时候,在浏览器中没有显示我的头像。它只显示我的名字,但是当我像下面这样写时,就可以了。
Route::get('profile', [
'uses' => 'ProfileController@profile',
'as' => 'profile'
]);
这工作正常....
{{ asset(Auth::user()->profile_picture) }}
我用的是这种路由,没问题,没有报错
http://yoursite.com/profile/myprofile
Route::group(['prefix' => 'profile'], function (){
Route::get('/myprofile', [
'uses' => 'ProfileController@profile',
'as' => 'pages.profile'
]);
});
or:
http://yoursite.com/myprofile
Route::get('/myprofile', [
'uses' => 'ProfileController@profile',
'as' => 'pages.profile'
]);
{{ route('pages.profile') }}
对于要附加的图像或任何文件,请使用此代码:
{{ URL::to('your file path') }}