2016-12-15 103 views
0
<a href="@{{ post.user.profileUrl }}">@ {{ post.user.name }}</a> 

是创造错误的行,它应该是链接到用户NotFoundHttpException在RouteCollection.php线161,而试图点击一个链接在laravel 5.2

简单地做

的轮廓
<h2>@{{ post.user.profileUrl }}</h2> 

被给予正确的地址,并输入指出地址也带我到正确的页面,但该链接它给错误

航线文件

Route::get('/', function() { 
return view('auth/login'); 
}); 

Route::auth(); 

Route::get('/home', '[email protected]'); 

Route::post('/posts', '[email protected]'); 

Route::get('users/{user}', '[email protected]')->name('user.index');  

任何人都请帮助...

+0

请出示您的路线文件! –

+0

您仍然需要在{{}}中使用php语法。后者基本上只是一个回声语句(包裹在字符转义函数中)。 – devk

+0

@SaumyaRastogi路由列表已更新,请查看 – Ronit

回答

0

在您的路线/ web.php:

Route::get('/post/user/profile', '[email protected]')->name('post.user.profile'); 

然后在您的视图: <a href="{{ route('post.user.profile') }}">Profile</a>

诗篇。我尽可能简单,因为我在这里使用路线的方式对我来说没有多大意义。

+0

否,我正在从正在生成的json响应中拉出它,并将帖子作为帖子的循环来使用。 – Ronit

+0

post.user.profileUrl上有哪些值? –

+0

它提供了一个地址http:// localhost:8000/users/1 – Ronit

相关问题