/** * Store a newly created resource in storage. * * @return Response */ public function store(RegistrationFormRequest $request) { $input = $request->only('email', 'password', 'first_name', 'last_name'); $user = Sentinel::registerAndActivate($input); // Find the role using the role name $usersRole = Sentinel::findRoleByName('Users'); // Assign the role to the users $usersRole->users()->attach($user); return redirect('login')->with('success', 'User has been created'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(RegistrationFormRequest $request) { $input = $request->only('nik', 'password', 'name'); $user = Sentinel::registerAndActivate($input); // Find the role using the role name $usersRole = Sentinel::findRoleByName('Users'); // Assign the role to the users $usersRole->users()->attach($user); return redirect('/auth.create')->withFlashMessage('User Successfully Created!'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(RegistrationFormRequest $request) { $input = $request->only('email', 'password', 'first_name', 'last_name'); $input = array_add($input, 'activated', true); $user = $this->user->create($input); // Find the group using the group name $usersGroup = \Sentry::findGroupByName('Users'); // Assign the group to the user $user->addGroup($usersGroup); return redirect('login')->withFlashMessage('User Successfully Created!'); }
/** * @param Requests\RegistrationFormRequest $request * * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function registration(Requests\RegistrationFormRequest $request) { $data = $request->only('username', 'email', 'password'); $data['password'] = Hash::make($data['password']); $user = new User($data); if ($user->save()) { $this->auth->login($user); return redirect('chat'); } else { return redirect('/')->withErrors(['username' => 'Oops... Something wrong is happened. Try again.'], $request->getErrorBag()); } }