コード例 #1
0
ファイル: Registrar.php プロジェクト: qbana/printon
 public function create(array $data)
 {
     $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     $user->attachRole($data['role']);
     $user->attachPermission($data['permission']);
     return $user;
 }
コード例 #2
0
 public function run()
 {
     $users = User::all();
     $roles = Role::all();
     foreach ($users as $user) {
         $user->attachRole($roles[rand(0, count($roles) - 1)]);
     }
 }
コード例 #3
0
 public function run()
 {
     $users = User::all();
     $permissions = Permission::all();
     foreach ($users as $user) {
         $user->attachPermission($permissions[rand(0, count($permissions) - 1)]);
     }
 }