im creating url friendly in my app, but is not working, the app is giving me some issues related with "-". Is giving me a error of:
ErrorException in PostController.php line 60:
Trying to get property of non-object
My ideal url is:
http://ift.tt/2ixVuGp
My route is:
Route::get('{category}-{title}-{id}', 'PostController@show');
PostController show function:
public function show($category,$title,$id)
{
$post = Post::find($id);
$user = Auth::user();
$comments = Comment::where('post_id',$id)
->where('approved',1)
->get();
return view('posts.show',compact('post','comments','user'));
}
Blade View:
<?php
$title_seo = str_slug($feature->title, '-');
?>
<a href="" rel="bookmark">
...</a>
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2itgxi5
via IFTTT
Aucun commentaire:
Enregistrer un commentaire