We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -8,24 +8,24 @@ |
||
8 | 8 | class PermissionGeneratorBackpackCommand extends Command |
9 | 9 | { |
10 | 10 | /** |
11 | - * The name and signature of the console command. |
|
12 | - * |
|
13 | - * @var string |
|
14 | - */ |
|
11 | + * The name and signature of the console command. |
|
12 | + * |
|
13 | + * @var string |
|
14 | + */ |
|
15 | 15 | protected $signature = 'backpack:permissions {route : Name of the route e.g admin/teams} {--P|permission=* : A permission you wish to add, can accept multiple instances of -P|permission}'; |
16 | 16 | |
17 | 17 | /** |
18 | - * The console command description. |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
18 | + * The console command description. |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | 22 | protected $description = 'Will generate permissions for routes and save to the database'; |
23 | 23 | |
24 | 24 | /** |
25 | - * Execute the console command. |
|
26 | - * |
|
27 | - * @return mixed |
|
28 | - */ |
|
25 | + * Execute the console command. |
|
26 | + * |
|
27 | + * @return mixed |
|
28 | + */ |
|
29 | 29 | public function handle() |
30 | 30 | { |
31 | 31 | $routeName = $this->argument('route'); |
@@ -29,28 +29,28 @@ discard block |
||
29 | 29 | public function handle() |
30 | 30 | { |
31 | 31 | $routeName = $this->argument('route'); |
32 | - $permissions = ['list', 'create', 'update', 'reorder', 'delete']; |
|
32 | + $permissions = [ 'list', 'create', 'update', 'reorder', 'delete' ]; |
|
33 | 33 | $permissionsAdded = 0; |
34 | 34 | $customPermissions = $this->option('permission'); |
35 | 35 | |
36 | - if(count($customPermissions) > 0){ |
|
36 | + if (count($customPermissions) > 0) { |
|
37 | 37 | $permissions = $customPermissions; |
38 | 38 | } |
39 | 39 | |
40 | 40 | $bar = $this->output->createProgressBar(count($permissions)); |
41 | 41 | |
42 | - foreach($permissions as $permission){ |
|
42 | + foreach ($permissions as $permission) { |
|
43 | 43 | |
44 | 44 | $permissionName = trim($routeName, '/').'/'.trim($permission, '/'); |
45 | 45 | $permissionName = strtolower($permissionName); |
46 | 46 | |
47 | - $existingPermission = Permission::where(['name' => $permissionName])->first(); |
|
47 | + $existingPermission = Permission::where([ 'name' => $permissionName ])->first(); |
|
48 | 48 | |
49 | - if($existingPermission){ |
|
49 | + if ($existingPermission) { |
|
50 | 50 | |
51 | 51 | $continueAdding = $this->confirm("$permissionName already exists, do you want to carry on? [y|N]"); |
52 | 52 | |
53 | - if($continueAdding){ |
|
53 | + if ($continueAdding) { |
|
54 | 54 | $bar->setMessage("Skipping $permissionName"); |
55 | 55 | $bar->advance(); |
56 | 56 | continue; |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | return $this->error("\nCancelled adding any more permissions."); |
60 | 60 | } |
61 | 61 | } else { |
62 | - $newPermission = Permission::create(['name' => $permissionName]); |
|
62 | + $newPermission = Permission::create([ 'name' => $permissionName ]); |
|
63 | 63 | $newPermission->save(); |
64 | 64 | |
65 | - if($newPermission->id){ |
|
65 | + if ($newPermission->id) { |
|
66 | 66 | $permissionsAdded++; |
67 | 67 | $bar->setMessage("$newPermission->name added with ID: $newPermission->id"); |
68 | 68 | $bar->advance(); |