Inheritance: extends App\Http\Requests\Request
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StoreClientRequest $request)
 {
     $users = User::where('email', $request['email'])->get();
     if (count($users) != 0) {
         return back()->withErrors(['Ya Registro este email']);
     }
     $input = $request->all();
     $user = new User();
     $user->name = $input['name'];
     $user->lastName = $input['lastname'];
     $user->password = bcrypt($input['password']);
     $user->di_type = $input['di_type'];
     $user->di = $input['di'];
     $user->address = $input['address'];
     $user->phone = $input['phone'];
     $user->email = $input['email'];
     $user->image = "images/avatar_2x.png";
     $user->points = 0;
     $user->birthday = new Carbon($input['birthday']);
     $user->role_id = Role::where('description', 'client')->get()->first()->id;
     $user->save();
     Session::flash('message', 'Su cuenta se ha creado. Puede iniciar sesión');
     Session::flash('alert-class', 'alert-success');
     return redirect('/');
 }
示例#2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(StoreClientRequest $request)
 {
     $this->clients->create($request->all());
     return redirect()->route('clients.index');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(StoreClientRequest $request)
 {
     $this->clients->create($request->all());
     Session()->flash('flash_message', 'Client successfully added');
     return redirect()->route('clients.index');
 }