public function show($id)
 {
     $topic = Topic::findOrFail($id);
     $active_menu = '';
     $user = $topic->user;
     $product = $topic->product;
     return view('topic', compact(['topic', 'active_menu', 'product']));
 }
public function show($id){
try{
$topic = Topic::findOrFail($id);
//счетчик просмотров
if(empty($this->user) or $this->user->id != $topic->user_id){
\DB::table('yiitopics')->increment('views');
}
return view('topics.show',[
'topic' => $topic
]);
}catch(ModelNotFoundException $e){
return view('errors.404');
}
}