public function userPosts($userid) { $blogs = $this->getBlogsByUserId($userid); if (count($blogs) == 0) { abort(403, 'Unauthorized action.'); } return view('pages.userblogs', compact('blogs') + ['description' => " All Blogs by " . User::findOrfail($userid)->name]); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }