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


PHP User::unguard方法代码示例

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


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

示例1: makeUser

 protected function makeUser()
 {
     User::unguard();
     $user = User::create(['email' => $this->fake->unique()->email, 'password' => $this->fake->word, 'first_name' => $this->fake->firstName, 'last_name' => $this->fake->lastName]);
     User::reguard();
     return $user;
 }
开发者ID:captainblue2013,项目名称:Lumen,代码行数:7,代码来源:TestCase.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     DB::table('user_roles')->delete();
     User::reguard();
     $users_data = [['name' => 'John Doe', 'email' => 'notauth@gmail.com', 'password' => bcrypt('secret'), 'image' => 'minion3.jpg', 'role' => 0], ['name' => 'Christina Doe', 'email' => 'auth@gmail.com', 'password' => bcrypt('secret'), 'image' => 'minion4.jpg', 'role' => 1], ['name' => 'Demo', 'email' => 'demo@demo.com', 'password' => bcrypt('demodemo'), 'image' => 'minion4.jpg', 'role' => 2], ['name' => 'Ben Doe', 'email' => 'admin@gmail.com', 'password' => bcrypt('secret'), 'image' => 'minion3.jpg', 'role' => 2], ['name' => 'Jessica Doe', 'email' => 'superadmin@gmail.com', 'password' => bcrypt('secret'), 'image' => 'minion4.jpg', 'role' => 3], ['name' => 'Jack Doe', 'email' => 'owner@gmail.com', 'password' => bcrypt('secret'), 'image' => 'minion5.jpg', 'role' => 4]];
     foreach ($users_data as $data) {
         $user = User::create($data);
         $user->UserRoles()->save(new UserRoles($data));
     }
     User::unguard();
 }
开发者ID:szwork2013,项目名称:laravel-angular-cms,代码行数:17,代码来源:UserTableSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     DB::table('user_roles')->delete();
     User::reguard();
     $users_data = [['name' => 'Manfred Walder', 'email' => 'office@manfredwalder.at', 'password' => bcrypt('vald1234'), 'image' => 'minion3.jpg', 'role' => 4]];
     foreach ($users_data as $data) {
         $user = User::create($data);
         $user->UserRoles()->save(new UserRoles($data));
     }
     User::unguard();
 }
开发者ID:magnolo,项目名称:moessler_web2,代码行数:17,代码来源:UserTableSeeder.php

示例4: signup

 public function signup(Request $request)
 {
     $signupFields = Config::get('boilerplate.signup_fields');
     $hasToReleaseToken = Config::get('boilerplate.signup_token_release');
     $userData = $request->only($signupFields);
     $validator = Validator::make($userData, Config::get('boilerplate.signup_fields_rules'));
     if ($validator->fails()) {
         throw new ValidationHttpException($validator->errors()->all());
     }
     User::unguard();
     $user = User::create($userData);
     User::reguard();
     if (!$user->id) {
         return $this->response->error('could_not_create_user', 500);
     }
     if ($hasToReleaseToken) {
         return $this->login($request);
     }
     return $this->response->created();
 }
开发者ID:muhammadshakeel,项目名称:laravel-api-boilerplate-oauth,代码行数:20,代码来源:AuthController.php

示例5: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     User::unguard();
     $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'phone' => $data['phone'], 'password' => bcrypt($data['password'])]);
     User::reguard();
     $role = new UserRole();
     $role->user_id = $user->id;
     $role->role_id = 2;
     $role->save();
     /**
      * Send a welcome message
      */
     $message = "Hi " . $data['name'] . ". Your account has been activated. Have a good day";
     send_message($data['phone'], $message);
     /**
      * Send email for account creation
      */
     Mail::send('emails.register', compact('user'), function ($message) use($user) {
         $message->from(get_option('sent_from'), get_option('app'));
         $message->to($user->email, $user->name)->subject(get_option('app') . ' Registration Successful');
     });
     return $user;
 }
开发者ID:soarmorrow,项目名称:grabage-collector,代码行数:29,代码来源:Registrar.php

示例6: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     if ($request->method() == 'POST') {
         $this->validate($request, $this->user_rule);
         $user = $request->except('_token', 'confirm_password', 'roles');
         $user['password'] = bcrypt($request->input('password'));
         $user['created_at'] = current_time();
         $user['phone'] = remove_symbols($request->input('phone'));
         User::unguard();
         $addUser = User::create($user);
         User::reguard();
         if ($addUser) {
             $role = new UserRole();
             $role->user_id = $addUser->id;
             $role->role_id = $request->input('roles');
             $role->save();
             return redirect()->back()->with('success', 'New user added');
         } else {
             return redirect()->back()->with('error', 'Failed to add user');
         }
     } else {
         return view('backend.users.add');
     }
 }
开发者ID:soarmorrow,项目名称:grabage-collector,代码行数:29,代码来源:UsersController.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::unguard();
     User::create(['name' => 'user', 'email' => 'mail@mail.com', 'password' => 'password']);
     User::reguard();
 }
开发者ID:sabahtalateh,项目名称:laracast,代码行数:11,代码来源:UserTableSeeder.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::unguard();
     factory(User::class, 10)->create();
     User::reguard();
 }
开发者ID:malyusha,项目名称:new-year,代码行数:11,代码来源:UsersSeeder.php


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