Пример #1
0
 public function postCreate()
 {
     $validator = Validator::make(Input::all(), User::$rules);
     if ($validator->passes()) {
         $user = new User();
         $user->username = Input::get('username');
         $user->email = Input::get('email');
         $user->type = 'Integrant';
         $user->password = Hash::make(Input::get('password'));
         $user->save();
         $user_id = $user->id;
         $userProfile = new UsersProfile();
         $userProfile->fullname = Input::get('fullname');
         $userProfile->website = Input::get('website');
         $userProfile->about = Input::get('about');
         $userProfile->user_id = $user_id;
         $userProfile->save();
         return Redirect::to('users/login')->with('message', 'Thanks for registering!');
     } else {
         return Redirect::to('users/register')->with('message', 'The following errors occurred')->withErrors($validator)->withInput();
     }
 }