public function register($userData) { $user = new User([ 'username' => $userData->username, 'email' => $userData->email, 'password' => bcrypt($userData->password) ]); $user->save(); return $user; }
/** * Store a newly created resource in storage. * * @param UserEdit $request * @return \Illuminate\Http\Response */ public function store(UserEdit $request) { try { UserService::save($request->all()); return view('admin.user.index')->with('message', 'New user created'); } catch (\Exception $e) { return view('admin.user.create')->with('fail', 'Create user failed')->withInput(); } }
/** * @return \User * @throws UserException */ public function getUser() { if ($this->user === false) { $user = null; $session = $this->authManager->getSession(); if ($session) { $identity = $session->getIdentity(); $user = \User::findFirst((int) $identity); } $this->user = $user; } return $this->user; }
/** * 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'])]); }
/** * [updateContributorAndConnectBook description] * @param [type] $book_id [description] * @param [type] $data [description] * @param [type] $avatar [description] * @return [type] [description] */ public function updateContributorAndConnectBook($authorId, $data, $filename) { User::find($authorId)->update(['lastname' => $data['name'], 'blurb' => $data['blurb'], 'email' => $data['email'], 'twitter_id' => $data['twitter_id'], 'github' => $data['github'], 'avatar' => $filename]); }