pratiksh404 /
adminetic
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Pratiksh\Adminetic\Services; |
||
| 4 | |||
| 5 | use App\Models\User; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use Pratiksh\Adminetic\Models\Admin\Role; |
||
| 7 | use Pratiksh\Adminetic\Services\Helper\CommandHelper; |
||
| 8 | |||
| 9 | class MakeSuperAdmin extends CommandHelper |
||
| 10 | { |
||
| 11 | public static function checkAuthorization($authorization_password) |
||
| 12 | { |
||
| 13 | return trim($authorization_password) == 'makemesuper'; |
||
| 14 | } |
||
| 15 | |||
| 16 | public static function make($name, $email, $password) |
||
| 17 | { |
||
| 18 | $user = User::firstOrCreate([ |
||
| 19 | 'email' => trim($email), |
||
| 20 | ], [ |
||
| 21 | 'name' => trim($name), |
||
| 22 | 'password' => bcrypt($password), |
||
| 23 | ]); |
||
| 24 | |||
| 25 | $role = Role::where('name', 'superadmin')->exists() |
||
| 26 | ? Role::where('name', 'superadmin')->first() |
||
| 27 | : $role = Role::create([ |
||
|
0 ignored issues
–
show
|
|||
| 28 | 'name' => 'superadmin', |
||
| 29 | 'description' => 'This is super admin. This role has authority over everything in this application.', |
||
| 30 | 'level' => 6, |
||
| 31 | ]); |
||
| 32 | $user->roles()->attach($role); |
||
| 33 | $user->profile()->create(); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths