/** * display the user information of the given id * @param $id * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|\Symfony\Component\HttpFoundation\Response */ public function getUser($id) { $user = User::find($id); if ($user == null) { return response('User Not Found', 404); } $profile = $user->userProfile; $posts = array('all' => $user->posts()->withTrashed()->get()->count(), 'active' => $user->posts->count(), 'deleted' => $user->posts()->onlyTrashed()->get()->count()); return view('admin.user.index', ['user' => $user, 'profile' => $profile, 'posts' => (object) $posts]); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['username' => $data['username'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }