pratiksh404 /
adminetic
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace Pratiksh\Adminetic\Console\Commands; |
||||||
| 4 | |||||||
| 5 | use App\Models\User; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 6 | use Illuminate\Console\Command; |
||||||
| 7 | use Illuminate\Support\Facades\Artisan; |
||||||
| 8 | use Illuminate\Support\Facades\DB; |
||||||
| 9 | use Illuminate\Support\Facades\Hash; |
||||||
| 10 | use Pratiksh\Adminetic\Models\Admin\Role; |
||||||
| 11 | |||||||
| 12 | class AdmineticDummyCommand extends Command |
||||||
| 13 | { |
||||||
| 14 | /** |
||||||
| 15 | * The name and signature of the console command. |
||||||
| 16 | * |
||||||
| 17 | * @var string |
||||||
| 18 | */ |
||||||
| 19 | protected $signature = 'adminetic:dummy'; |
||||||
| 20 | |||||||
| 21 | /** |
||||||
| 22 | * The console command description. |
||||||
| 23 | * |
||||||
| 24 | * @var string |
||||||
| 25 | */ |
||||||
| 26 | protected $description = 'Fetch dummy data'; |
||||||
| 27 | |||||||
| 28 | /** |
||||||
| 29 | * Create a new command instance. |
||||||
| 30 | * |
||||||
| 31 | * @return void |
||||||
| 32 | */ |
||||||
| 33 | public function __construct() |
||||||
| 34 | { |
||||||
| 35 | parent::__construct(); |
||||||
| 36 | } |
||||||
| 37 | |||||||
| 38 | /** |
||||||
| 39 | * Execute the console command. |
||||||
| 40 | * |
||||||
| 41 | * @return int |
||||||
| 42 | */ |
||||||
| 43 | public function handle() |
||||||
| 44 | { |
||||||
| 45 | if (! config('adminetic.migrate_with_dummy', false)) { |
||||||
| 46 | // Generating Roles |
||||||
| 47 | $roles = [ |
||||||
| 48 | [ |
||||||
| 49 | 'name' => 'superadmin', |
||||||
| 50 | 'description' => 'This is a super admin user', |
||||||
| 51 | 'level' => 5, |
||||||
| 52 | ], |
||||||
| 53 | [ |
||||||
| 54 | 'name' => 'admin', |
||||||
| 55 | 'description' => 'This is an admin user', |
||||||
| 56 | 'level' => 4, |
||||||
| 57 | ], |
||||||
| 58 | [ |
||||||
| 59 | 'name' => 'moderator', |
||||||
| 60 | 'description' => 'This is an moderator', |
||||||
| 61 | 'level' => 3, |
||||||
| 62 | ], |
||||||
| 63 | [ |
||||||
| 64 | 'name' => 'editor', |
||||||
| 65 | 'description' => 'This is an editor', |
||||||
| 66 | 'level' => 2, |
||||||
| 67 | ], |
||||||
| 68 | [ |
||||||
| 69 | 'name' => 'user', |
||||||
| 70 | 'description' => 'This is an normal user', |
||||||
| 71 | 'level' => 1, |
||||||
| 72 | ], |
||||||
| 73 | [ |
||||||
| 74 | 'name' => 'unverified', |
||||||
| 75 | 'description' => 'This is an unverified user', |
||||||
| 76 | 'level' => 0, |
||||||
| 77 | ], |
||||||
| 78 | ]; |
||||||
| 79 | |||||||
| 80 | DB::table('roles')->insert($roles); |
||||||
| 81 | |||||||
| 82 | // Generating Permission |
||||||
| 83 | Artisan::call('make:permission Role 2 --onlyFlags'); |
||||||
| 84 | Artisan::call('make:permission Permission 2 --onlyFlags'); |
||||||
| 85 | Artisan::call('make:permission User 2 --onlyFlags'); |
||||||
| 86 | |||||||
| 87 | Artisan::call('make:permission Setting 2 --onlyFlags'); |
||||||
| 88 | Artisan::call('make:permission Preference 2 --onlyFlags'); |
||||||
| 89 | |||||||
| 90 | // Generating User |
||||||
| 91 | $admin = User::create([ |
||||||
| 92 | 'name' => 'Admin User', |
||||||
| 93 | 'email' => '[email protected]', |
||||||
| 94 | 'password' => Hash::make('admin123'), |
||||||
| 95 | ]); |
||||||
| 96 | |||||||
| 97 | $role = Role::where('name', 'admin')->first(); |
||||||
| 98 | |||||||
| 99 | $admin->roles()->attach($role); |
||||||
| 100 | $admin->profile()->create(); |
||||||
| 101 | $this->info('Dummy data seeded ... ✅'); |
||||||
| 102 | } else { |
||||||
| 103 | $this->error('Dummy data seeding failed because seed on migration is turned on config file.'); |
||||||
| 104 | $this->warning("Change to 'migrate_with_dummy' => false"); |
||||||
|
0 ignored issues
–
show
The method
warning() does not exist on Pratiksh\Adminetic\Conso...s\AdmineticDummyCommand. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 105 | } |
||||||
| 106 | } |
||||||
| 107 | } |
||||||
| 108 |
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