Пример #1
0
 private function permissionsRole()
 {
     $data = array();
     $permissions = Role::join('permission_role', 'roles.id', '=', 'permission_role.role_id')->join('permissions', 'permission_role.permission_id', '=', 'permissions.id')->whereRaw('roles.id = ? AND permission_role.available = ?', [$this->idRole, 1])->get();
     foreach ($permissions as $permission) {
         $key = $permission->name;
         $data[$key] = array('permissionName' => $key, 'available' => $permission->available, 'inherit' => false);
     }
     return $data;
 }
Пример #2
0
 public function run()
 {
     $faker = Faker::create();
     Role::Create(['name' => 'superAdmin']);
     Role::Create(['name' => 'admin']);
     Role::Create(['name' => 'POS']);
     Role::Create(['name' => 'register']);
     foreach (range(1, 10) as $i) {
         $nameExtend = $faker->name;
         $nameExtend = explode(' ', $nameExtend);
         $name = array_shift($nameExtend);
         $last_name = implode(" ", $nameExtend);
         User::create(['name' => $name, 'last_name' => $last_name, 'user_name' => $faker->userName, 'email' => $faker->email, 'password' => \Hash::make(123456), 'roles_id' => $faker->randomElement([1, 2, 3]), 'location' => '1']);
     }
 }
Пример #3
0
 public function newUser()
 {
     $location = ["seleccione una region" => "seleccione una region"] + Location::all()->lists('name');
     $roles = ["seleccione un role" => "seleccione un role"] + Role::all()->lists('name', 'id');
     return View::make('back.userNew', compact('roles', 'location'));
 }