当前位置: 首页>>代码示例>>PHP>>正文


PHP User::errors方法代码示例

本文整理汇总了PHP中User::errors方法的典型用法代码示例。如果您正苦于以下问题:PHP User::errors方法的具体用法?PHP User::errors怎么用?PHP User::errors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User的用法示例。


在下文中一共展示了User::errors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postIndex

 /**
  * Stores new user
  *
  */
 public function postIndex()
 {
     //$this->user->terms = Input::get('terms');
     $this->user->username = Input::get('email');
     $this->user->email = Input::get('email');
     $password = Input::get('password');
     $passwordConfirmation = Input::get('password_confirmation');
     $this->user->pid = $this->keygen();
     if (!empty($password)) {
         if ($password === $passwordConfirmation) {
             $this->user->password = $password;
             // The password confirmation will be removed from model
             // before saving. This field will be used in Ardent's
             // auto validation.
             $this->user->password_confirmation = $passwordConfirmation;
         } else {
             // Redirect to the new user page
             return Redirect::to('user/create')->withInput(Input::except('password', 'password_confirmation'))->with('error', Lang::get('admin/users/messages.password_does_not_match'));
         }
     } else {
         unset($this->user->password);
         unset($this->user->password_confirmation);
     }
     // Save if valid. Password field will be hashed before save
     $this->user->save();
     if ($this->user->id) {
         DB::table('oauth_user_roles')->insert(array(array('user_id' => $this->user->pid, 'client_id' => 'http://govclient.nellcorp.com', 'role' => 'patient', 'created_at' => new DateTime(), 'updated_at' => new DateTime())));
         // Redirect with success message, You may replace "Lang::get(..." for your custom message.
         return Redirect::to('user/login')->with('notice', Lang::get('user/user.user_account_created'));
     } else {
         // Get validation errors (see Ardent package)
         $error = $this->user->errors()->all();
         return Redirect::to('user/create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
开发者ID:otherjohn,项目名称:govid,代码行数:39,代码来源:UserController.php

示例2: postIndex

 /**
  * Stores new user
  *
  */
 public function postIndex()
 {
     $this->user->email = Input::get('email');
     $password = Input::get('password');
     $passwordConfirmation = Input::get('password_confirmation');
     if (!empty($password)) {
         if ($password === $passwordConfirmation) {
             $this->user->password = $password;
             // The password confirmation will be removed from model
             // before saving. This field will be used in Ardent's
             // auto validation.
             $this->user->password_confirmation = $passwordConfirmation;
         } else {
             // Redirect to the new user page
             return Redirect::to('user/create')->withInput(Input::except('password', 'password_confirmation'))->with('error', Lang::get('admin/users/messages.password_does_not_match'));
         }
     } else {
         unset($this->user->password);
         unset($this->user->password_confirmation);
     }
     // Save if valid. Password field will be hashed before save
     $this->user->save();
     if ($this->user->id) {
         // Redirect with success message, You may replace "Lang::get(..." for your custom message.
         return Redirect::to('user/login')->with('notice', Lang::get('user/user.user_account_created'));
     } else {
         // Get validation errors (see Ardent package)
         $error = $this->user->errors()->all();
         return Redirect::to('user/create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
开发者ID:hilmysyarif,项目名称:l4-bootstrap-admin,代码行数:35,代码来源:UserController.php

示例3: store

 /**
  * Stores new account
  *
  */
 public function store()
 {
     // Validate the inputs
     $rules = array('username' => 'required|alpha_dash|unique:users,username', 'fullname' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'between:4,11|confirmed', 'password_confirmation' => 'between:4,11');
     $this->user->username = Input::get('username');
     $this->user->fullname = Input::get('fullname');
     $this->user->email = Input::get('email');
     $this->user->password = Input::get('password');
     // The password confirmation will be removed from model
     // before saving. This field will be used in Ardent's
     // auto validation.
     $this->user->password_confirmation = Input::get('password_confirmation');
     $this->user->confirmed = Input::get('confirm');
     // Permissions are currently tied to roles. Can't do this yet.
     //$user->permissions = $user->roles()->preparePermissionsForSave(Input::get( 'permissions' ));
     // Save if valid. Password field will be hashed before save
     $this->user->save($rules);
     if ($this->user->id) {
         // Save roles. Handles updating.
         $this->user->saveRoles(Input::get('roles'));
         // Redirect to the new user page
         //return Redirect::to('users/' . $this->user->id . '/edit')->with('success', Lang::get('admin/users/messages.create.success'));
         return Redirect::to('admin/users')->with('success', Lang::get('admin/user/messages.create.success'));
     } else {
         // Get validation errors (see Ardent package)
         $error = $this->user->errors()->all();
         return Redirect::to('admin/users/create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
开发者ID:ehumps,项目名称:rendezview,代码行数:33,代码来源:AdminUserController.php

示例4: run

 public function run()
 {
     $user = new User();
     $user->username = 'vee';
     $user->email = 'vibhavee.t@gmail.com';
     $user->password = '1234';
     $user->role = 'Admin';
     $user->password_confirmation = '1234';
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->confirmed = true;
     if (!$user->save()) {
         Log::info('Unable to create user ' . $user->username, (array) $user->errors());
     } else {
         Log::info('Created user "' . $user->username . '" <' . $user->email . '>');
     }
     $user = new User();
     $user->username = 'test';
     $user->email = 'test@gmail.com';
     $user->password = '1234';
     $user->role = 'User';
     $user->password_confirmation = '1234';
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->confirmed = true;
     if (!$user->save()) {
         Log::info('Unable to create user ' . $user->username, (array) $user->errors());
     } else {
         Log::info('Created user "' . $user->username . '" <' . $user->email . '>');
     }
 }
开发者ID:withlovee,项目名称:HAII,代码行数:29,代码来源:DatabaseSeeder.php

示例5: postCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate()
 {
     $rules = array('displayname' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:4');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $this->user->displayname = Input::get('displayname');
         $this->user->email = Input::get('email');
         $this->user->password = Input::get('password');
         $this->user->password_confirmation = Input::get('password_confirmation');
         $this->user->confirmed = Input::get('confirm');
         $this->user->save();
         Event::fire('controller.user.create', array($this->user));
         if ($this->user->id) {
             $this->user->saveRoles(Input::get('roles'));
             $pro = Input::get('user_profiles');
             $profile = new UserProfile($pro['new']);
             $user = User::find($this->user->id);
             $user->profiles()->save($profile);
             Activity::log(array('contentID' => $this->user->id, 'contentType' => 'account_created', 'description' => $this->user->id, 'details' => 'account_created', 'updated' => Confide::user()->id ? true : false));
             return Api::to(array('success', Lang::get('admin/users/messages.create.success'))) ?: Redirect::to('admin/users/' . $this->user->id . '/edit')->with('success', Lang::get('admin/users/messages.create.success'));
         } else {
             return Api::to(array('error', $this->user->errors()->all())) ?: Redirect::to('admin/users/create')->withInput(Input::except('password'))->with('error', $this->user->errors()->all());
         }
     } else {
         return Api::to(array('error', Lang::get('admin/users/messages.edit.error'))) ?: Redirect::to('admin/users/create')->withInput(Input::except('password'))->with('error', Lang::get('admin/users/messages.edit.error'))->withErrors($validator);
     }
 }
开发者ID:Aranjedeath,项目名称:l4-starter,代码行数:32,代码来源:AdminUsersController.php

示例6: postCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate()
 {
     $this->user->username = Input::get('username');
     $this->user->email = Input::get('email');
     $this->user->password = Input::get('password');
     // The password confirmation will be removed from model
     // before saving. This field will be used in Ardent's
     // auto validation.
     $this->user->password_confirmation = Input::get('password_confirmation');
     $this->user->confirmed = Input::get('confirm');
     // Permissions are currently tied to roles. Can't do this yet.
     //$user->permissions = $user->roles()->preparePermissionsForSave(Input::get( 'permissions' ));
     // Save if valid. Password field will be hashed before save
     $this->user->save();
     if ($this->user->id) {
         // Save roles. Handles updating.
         $this->user->saveRoles(Input::get('roles'));
         // Redirect to the new user page
         return Redirect::to('admin/users/' . $this->user->id . '/edit')->with('success', Lang::get('admin/users/messages.create.success'));
     } else {
         // Get validation errors (see Ardent package)
         $error = $this->user->errors()->all();
         return Redirect::to('admin/users/create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
开发者ID:OriPekelman,项目名称:platformsh-example-laravel,代码行数:30,代码来源:AdminUsersController.php

示例7: updateProfile

 function updateProfile()
 {
     $input = Input::parse();
     if (Token::check($input['token'])) {
         $user = new User();
         $user->set(array('name' => $input['name'], 'username' => $input['username']));
         if (!$user->errors()) {
             $user->update();
             Session::flash('success', 'Successfully updated');
             Redirect::to('profile');
         } else {
             Session::flash('error', $user->errors());
             Redirect::to('profile');
         }
     }
 }
开发者ID:Jay-En,项目名称:BonePHP-starter,代码行数:16,代码来源:profileController.php

示例8: postCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate()
 {
     $this->user->displayname = Input::get('displayname');
     $this->user->email = Input::get('email');
     $this->user->password = Input::get('password');
     // The password confirmation will be removed from model
     // before saving. This field will be used in Ardent's
     // auto validation.
     $this->user->password_confirmation = Input::get('password_confirmation');
     $this->user->confirmed = Input::get('confirm');
     // Save if valid. Password field will be hashed before save
     $this->user->save();
     if ($this->user->id) {
         // Save roles. Handles updating.
         $this->user->saveRoles(Input::get('roles'));
         $pro = Input::get('user_profiles');
         $profile = new UserProfile($pro['new']);
         $user = User::find($this->user->id);
         $user->profiles()->save($profile);
         // Redirect to the new user page
         return Redirect::to('admin/users/' . $this->user->id . '/edit')->with('success', Lang::get('admin/users/messages.create.success'));
     } else {
         // Get validation errors (see Ardent package)
         $error = $this->user->errors()->all();
         return Redirect::to('admin/users/create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
开发者ID:hilmysyarif,项目名称:l4-bootstrap-admin,代码行数:32,代码来源:AdminUsersController.php

示例9: run

 public function run()
 {
     $user = new User();
     $user->email = 'danny_kent@mail.ru';
     $user->username = 'danny-admin';
     $user->password = Hash::make('secret');
     $user->password_confirmation = $user->password;
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->confirmed = 1;
     if (!$user->save()) {
         Log::info('Unable to create user ' . $user->email, (array) $user->errors());
     } else {
         Log::info('Created user "' . $user->email . '" <' . $user->email . '>');
     }
     $admin = new Role();
     $admin->name = 'Admin';
     $admin->save();
     $user = new User();
     $user->email = 'somovlife@gmail.com';
     $user->username = 'ivan-admin';
     $user->password = Hash::make('secret');
     $user->password_confirmation = $user->password;
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->confirmed = 1;
     if (!$user->save()) {
         Log::info('Unable to create user ' . $user->email, (array) $user->errors());
     } else {
         Log::info('Created user "' . $user->email . '" <' . $user->email . '>');
     }
     $user = User::where('username', $user->username)->firstOrFail();
     $user->attachRole($admin);
 }
开发者ID:VerticalHorizon,项目名称:Bumagi,代码行数:32,代码来源:UsersTableSeeder.php

示例10: run

 public function run()
 {
     $user = new User();
     $user->first_name = $_ENV['USER_FIRST_NAME'];
     $user->last_name = $_ENV['USER_LAST_NAME'];
     $user->username = $_ENV['USER_USERNAME'];
     $user->email = $_ENV['USER_EMAIL'];
     $user->password = $_ENV['USER_PASS'];
     $user->password_confirmation = $_ENV['USER_PASS'];
     $user->confirmed = 1;
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     if (!$user->save()) {
         Log::info('Unable to create user ' . $user->email, (array) $user->errors());
     } else {
         Log::info('Created user ' . $user->email);
     }
     $guest = new User();
     $guest->first_name = $_ENV['GUEST_FIRST_NAME'];
     $guest->last_name = $_ENV['GUEST_LAST_NAME'];
     $guest->username = $_ENV['GUEST_USERNAME'];
     $guest->email = $_ENV['GUEST_EMAIL'];
     $guest->password = $_ENV['GUEST_PASS'];
     $guest->password_confirmation = $_ENV['GUEST_PASS'];
     $guest->confirmed = 1;
     $guest->confirmation_code = md5(uniqid(mt_rand(), true));
     if (!$guest->save()) {
         Log::info('Unable to create user ' . $guest->email, (array) $guest->errors());
     } else {
         Log::info('Created user ' . $guest->email);
     }
 }
开发者ID:BobFromAccounting,项目名称:laravel_blog,代码行数:31,代码来源:UsersTableSeeder.php

示例11: store

 /**
  * Stores new account
  *
  */
 public function store()
 {
     $user = new User();
     $user->firstname = Input::get('firstname');
     $user->lastname = Input::get('lastname');
     $user->email = Input::get('email');
     $matches = explode("@", $user->email);
     $username = isset($matches[0]) ? $matches[0] : $user->firstname . '_' . $user->lastname;
     $username = preg_replace("/[^0-9a-zA-Z-]/", '', $username);
     $user->username = $username;
     $user->password = Input::get('password');
     $user->gender = Input::get('gender');
     $user->type = Input::has('type') ? Input::get('type') : 'dreamer';
     // The password confirmation will be removed from model
     // before saving. This field will be used in Ardent's
     // auto validation.
     $user->password_confirmation = Input::get('password_confirmation');
     // Save if valid. Password field will be hashed before save
     $user->save();
     if ($user->id) {
         // Redirect with success message, You may replace "Lang::get(..." for your custom message.
         return Redirect::action('UserController@login')->with('notice', Lang::get('confide::confide.alerts.account_created'));
     } else {
         // Get validation errors (see Ardent package)
         $error = $user->errors()->all(':message');
         return Redirect::action('UserController@create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
开发者ID:jaymondigo,项目名称:hutogbalba-app,代码行数:32,代码来源:UserController.php

示例12: store

 /**
  * Stores new account
  *
  */
 public function store()
 {
     $user = new User();
     $user->first_name = Input::get('first_name');
     $user->last_name = Input::get('last_name');
     $user->username = Input::get('username');
     $user->email = Input::get('email');
     $user->password = Input::get('password');
     User::setRules('store');
     // Hacky workaround for: https://github.com/laravelbook/ardent/issues/152
     if (app()->env === 'testing') {
         unset(User::$rules['password_confirmation']);
         unset(User::$rules['password']);
     } else {
         $user->password_confirmation = Input::get('password_confirmation');
     }
     $user->save();
     if ($user->getKey()) {
         $notice = Lang::get('confide::confide.alerts.account_created') . ' ' . Lang::get('confide::confide.alerts.instructions_sent');
         $user->roles()->sync([6]);
         // Redirect with success message, You may replace "Lang::get(..." for your custom message.
         return Redirect::action('AuthController@login')->with('notice', $notice);
     } else {
         // Get validation errors (see Ardent package)
         $error = $user->errors()->all(':message');
         return Redirect::action('AuthController@create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
开发者ID:k4ml,项目名称:laravel-base,代码行数:32,代码来源:AuthController.php

示例13: postCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate()
 {
     $this->user->username = Input::get('username');
     $this->user->email = Input::get('email');
     $this->user->password = Input::get('password');
     // The password confirmation will be removed from model
     // before saving. This field will be used in Ardent's
     // auto validation.
     $this->user->password_confirmation = Input::get('password_confirmation');
     $this->user->confirmed = Input::get('confirm');
     // Permissions are currently tied to roles. Can't do this yet.
     //$user->permissions = $user->roles()->preparePermissionsForSave(Input::get( 'permissions' ));
     // Save if valid. Password field will be hashed before save
     $this->user->engine_key = Hash::make(uniqid(mt_rand(), true));
     $this->user->save();
     try {
         // Register the user on the engine
         $return = xDockerEngine::register(array('username' => $this->user->username, 'password' => $this->user->engine_key));
         Log::info("Return Status : " . $return);
         EngineLog::logIt(array('user_id' => $this->user->id, 'method' => 'admin:register', 'return' => $return));
     } catch (Exception $e) {
         Log::error('Error while registering the user!' . $e->getMessage());
     }
     if ($this->user->id) {
         // Save roles. Handles updating.
         $this->user->saveRoles(Input::get('roles'));
         // Redirect to the new user page
         return Redirect::to('admin/users/' . $this->user->id . '/edit')->with('success', Lang::get('admin/users/messages.create.success'));
     } else {
         // Get validation errors (see Ardent package)
         $error = $this->user->errors()->all();
         return Redirect::to('admin/users/create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
开发者ID:XDocker,项目名称:app,代码行数:39,代码来源:AdminUsersController.php

示例14: run

 public function run()
 {
     $user = new User();
     $user->username = 'jd.hernandez@me.com';
     $user->email = 'jd.hernandez@me.com';
     $user->password = '@Password1';
     $user->password_confirmation = '@Password1';
     $user->confirmed = 1;
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->save();
     $profile = new Profile();
     $profile->user_id = $user->id;
     $profile->firstname = 'David';
     $profile->lastname = 'Hernandez';
     $profile->mobile = '(916)952-5736';
     $profile->dob = '09/24/1986';
     $profile->avatar = '/img/coach-avatar.jpg';
     $profile->save();
     if (!$user->id) {
         Log::info('Unable to create user ' . $user->username, (array) $user->errors());
     } else {
         Log::info('Created user "' . $user->username . '" <' . $user->email . '>');
     }
     $user1 = new User();
     $user1->username = 'david.hernandez@plusconsulting.co';
     $user1->email = 'david.hernandez@plusconsulting.co';
     $user1->password = '@Password1';
     $user1->password_confirmation = '@Password1';
     $user1->confirmed = 1;
     $user1->confirmation_code = md5(uniqid(mt_rand(), true));
     $user1->save();
     $profile1 = new Profile();
     $profile1->user_id = $user1->id;
     $profile1->firstname = 'David';
     $profile1->lastname = 'Hernandez';
     $profile1->mobile = '(916)952-5736';
     $profile->dob = '09/24/1986';
     $profile1->avatar = '/img/coach-avatar.jpg';
     $profile1->save();
     if (!$user1->id) {
         Log::info('Unable to create user ' . $user1->username, (array) $user1->errors());
     } else {
         Log::info('Created user "' . $user1->username . '" <' . $user1->email . '>');
     }
     $admin = new Role();
     $admin->name = 'administrator';
     $admin->save();
     $club = new Role();
     $club->name = 'club owner';
     $club->save();
     $club2 = new Role();
     $club2->name = 'club administrator';
     $club2->save();
     $default = new Role();
     $default->name = 'default';
     $default->save();
     $user->attachRole($club);
     $user1->attachRole($default);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:59,代码来源:UsersTableSeeder.php

示例15: run

 public function run()
 {
     Eloquent::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     // Roles
     DB::table('roles')->delete();
     Role::create(array('name' => 'Admin'));
     Role::create(array('name' => 'Manager'));
     Role::create(array('name' => 'Player'));
     // Users
     DB::table('users')->delete();
     // Admin
     $user = new User();
     $user->email = 'jp.bourdon@mid-amateur.be';
     $user->password = 'Birdie002$';
     $user->username = 'Jpb';
     $user->password_confirmation = 'Birdie002$';
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->confirmed = 1;
     if (!$user->save()) {
         Log::info('Unable to create user ' . $user->email, (array) $user->errors());
     } else {
         Log::info('Created user ' . $user->email);
     }
     $userRole = DB::table('roles')->where('name', '=', 'Admin')->pluck('id');
     $user->roles()->attach($userRole);
     // Manager
     $user = new User();
     $user->email = 'jp.bourdon.midam@gmail.com';
     $user->password = '1111';
     $user->username = 'Jpb-Manager';
     $user->password_confirmation = '1111';
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->confirmed = 1;
     if (!$user->save()) {
         Log::info('Unable to create user ' . $user->email, (array) $user->errors());
     } else {
         Log::info('Created user ' . $user->email);
     }
     $userRole = DB::table('roles')->where('name', '=', 'Manager')->pluck('id');
     $user->roles()->attach($userRole);
     // Player
     $user = new User();
     $user->email = 'infos@mid-amateur.be';
     $user->password = '1111';
     $user->username = 'Jpb-Player';
     $user->password_confirmation = '1111';
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->confirmed = 1;
     if (!$user->save()) {
         Log::info('Unable to create user ' . $user->email, (array) $user->errors());
     } else {
         Log::info('Created user ' . $user->email);
     }
     $userRole = DB::table('roles')->where('name', '=', 'Player')->pluck('id');
     $user->roles()->attach($userRole);
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
开发者ID:birdiebel,项目名称:G2016,代码行数:58,代码来源:InitialTableSeeder.php


注:本文中的User::errors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。