| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function run() |
||
| 30 | { |
||
| 31 | DB::statement('SET FOREIGN_KEY_CHECKS=0;'); |
||
| 32 | DB::table(config('rinvex.fort.tables.roles'))->truncate(); |
||
| 33 | |||
| 34 | // Get roles data |
||
| 35 | $roles = json_decode(file_get_contents(__DIR__.'/../../resources/data/roles.json'), true); |
||
| 36 | |||
| 37 | // Create new roles |
||
| 38 | foreach ($roles as $role) { |
||
| 39 | Role::create($role); |
||
| 40 | } |
||
| 41 | |||
| 42 | // Grant abilities to roles |
||
| 43 | Role::where('slug', 'admin')->first()->grantAbilities('superadmin', 'global'); |
||
| 44 | |||
| 45 | DB::statement('SET FOREIGN_KEY_CHECKS=1;'); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |