/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($slug, $id)
 {
     $post = Post::whereHas('translations', function ($query) use($slug) {
         $query->where('locale', '=', LaravelLocalization::getCurrentLocale())->where('slug', '=', $slug);
     })->where('id', '=', $id)->with('user')->firstOrFail();
     // return compact('post');
     return view('posts.show', compact('post'));
 }
 public function index()
 {
     $projects = Project::whereHas('status', function ($q) {
         $q->where('key', '=', 'published');
     })->limit(6)->orderBy('updated_at', 'desc')->get();
     $posts = Post::whereHas('status', function ($q) {
         $q->where('key', '=', 'published');
     })->limit(6)->orderBy('updated_at', 'desc')->get();
     return view('frontends.index')->with('projects', $projects)->with('posts', $posts);
 }