Esempio n. 1
0
 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUser $request)
 {
     $request->merge(['active' => 1, 'level' => 3]);
     $user = $this->userRepository->model->create($request->all());
     $this->authorize('authorizeAccess', 'user_create');
     if ($request->get('role')) {
         $user->roles()->sync($request->get('role'));
     } else {
         $user->roles()->sync([]);
     }
     return redirect()->action('Backend\\UsersController@index')->with('success', trans('messages.success.created'));
 }
Esempio n. 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateUser $request)
 {
     $user = $this->user->create($request->all());
     return redirect('user/' . $user->id);
 }
Esempio n. 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateUser $request)
 {
     //
     $input = $request->all();
     $input['user_type'] = 'Client';
     $input['remember_token'] = base64_encode($input['email']);
     $input['password'] = Hash::make($input['password']);
     try {
         // ...
         $user = User::create($input);
         $insertedId = $user->id;
         // send email
         Mail::send('emails.welcomemsg', ['user' => $user], function ($m) use($user) {
             $m->from('*****@*****.**', 'Your Application');
             $m->to($user->email, $user->name)->subject('Your Reminder!');
         });
         return redirect('/confirm');
     } catch (\Illuminate\Database\QueryException $e) {
         $mesg = "Insertion Fail";
         exit;
     }
 }
Esempio n. 4
0
 /**
  * Store users in database.
  *
  * @param CreateUser $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(CreateUser $request)
 {
     $data = $request->except(['password']);
     $data['password'] = bcrypt($request->input('password'));
     $this->user->create($data);
     $request->session()->flash('flash_message', 'User successfully added!');
     return redirect()->back();
 }