UserSeeder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 13 2
1
<?php
2
3
namespace Database\Seeders;
4
5
use App\Models\User;
0 ignored issues
show
Bug introduced by
The type App\Models\User was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Database\Seeder;
7
use Illuminate\Support\Facades\Hash;
8
use Pratiksh\Adminetic\Models\Admin\Role;
9
10
class UserSeeder extends Seeder
11
{
12
    /**
13
     * Run the database seeds.
14
     *
15
     * @return void
16
     */
17
    public function run()
18
    {
19
        if (! config('adminetic.migrate_with_dummy', false)) {
20
            $admin = User::create([
21
                'name' => 'Admin User',
22
                'email' => '[email protected]',
23
                'password' => Hash::make('admin123'),
24
            ]);
25
26
            $role = Role::where('name', 'admin')->first();
27
28
            $admin->roles()->attach($role);
29
            $admin->profile()->create();
30
        }
31
    }
32
}
33