コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::reguard();
     $modules = Module::all()->pluck('id');
     \DB::table('available_modules')->truncate();
     foreach ($modules as $id) {
         AvailableModule::create(['profile_type' => 'Administrator', 'module_id' => $id]);
     }
 }
コード例 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::reguard();
     \DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     \DB::table('permission_role')->truncate();
     \DB::table('permissions')->truncate();
     \DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     // Administrator User Management
     $module = Module::find(1);
     $data = [['name' => 'Create Administrator User', 'route' => 'admin.user.administrator.create'], ['name' => 'List Administrator User', 'route' => 'admin.user.administrator.list'], ['name' => 'Show Administrator User', 'route' => 'admin.user.administrator.show'], ['name' => 'Update Administrator User', 'route' => 'admin.user.administrator.update'], ['name' => 'Delete Administrator User', 'route' => 'admin.user.administrator.destroy']];
     $module->permissions()->createMany($data);
     // Administrator Role Management
     $module = Module::find(2);
     $data = [['name' => 'Create Administrator Role', 'route' => 'admin.administrator.role.create'], ['name' => 'List Administrator Role', 'route' => 'admin.administrator.role.list'], ['name' => 'Show Administrator Role', 'route' => 'admin.administrator.role.show'], ['name' => 'Update Administrator Role', 'route' => 'admin.administrator.role.update'], ['name' => 'Delete Administrator Role', 'route' => 'admin.administrator.role.destroy']];
     $module->permissions()->createMany($data);
 }