如何在视图laravel中定义slug

时间:2016-04-16 06:57:47

标签: php laravel laravel-5.2 foreign-key-relationship

我正在使用laravel 5.2
请告诉我如何在视图上定义slug 这是我的观点

@foreach($thread->forumindex()->where('slug', $slug)->firstorFail() as $forumindex)
<p>{{ $forumindex->title }}</p>
@endforeach

这是我的控制器

public function forumcomment($thread_slug, $slug){

    $thread = thread::where('slug', $thread_slug)->firstorFail();

    return view('forum.index.show', compact('thread'));

}

0 个答案:

没有答案