Пример #1
0
 /**
  * Update the User from the request from user.edit
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UserValidationRequest $request, User $user)
 {
     // also needs additional custom validation specific to updating User information. C.f. AuthController@postRegister
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $user->update($request->all());
     return redirect(route('user.show', ['user' => $user->id]));
 }
Пример #2
0
 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postRegister(UserValidationRequest $request)
 {
     // extra validation specific to registering Users
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     Auth::login($this->create($request->except('blog_name')));
     $newBlog = Blog::create(['name' => $request->blog_name, 'user_id' => Auth::user()->id]);
     $newBlog->save();
     return redirect($this->redirectPath());
 }