예제 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $roles = config('privileges.roles');
     foreach ($roles as $role) {
         Role::create(['name' => $role, 'description' => $role . ' role']);
     }
 }
예제 #2
0
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|min:3|max:255', 'description' => 'required']);
     $role = Role::create(['name' => $request->get('name'), 'description' => $request->get('description')]);
     $role->permissions()->sync($request->get('permissions'));
     $this->roleRepository->clearCache();
     return redirect()->route('laradmin.roles.index')->with('Role was created!');
 }