public function show($slug) { $article = Article::where('slug', $slug)->firstOrFail(); $articles = Article::where('published', 1)->whereNotIn('id', [$article->id])->whereHas('categories', function ($query) { $query->where('slug', 'noticias'); })->orderBy('created_at', 'DESC')->take(3)->get(); return view('news.show')->with('article', $article)->with('articles', $articles)->with('author', User::find($article->user_id))->with('currentMenu', 'news'); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }