zkyonsky / helpdesk

helpdesk laravel 8
5 stars 4 forks source link

Database Seeding issue #1

Open asifious opened 2 years ago

asifious commented 2 years ago

I'm getting this Error while seeding.. Please Help.

Seeding: Database\Seeders\UserTableSeeder

Error

Call to a member function givePermissionTo() on null

at D:\Software\Xampp\htdocs\helpdesk-main\database\seeders\UserTableSeeder.php:22 18▕ { 19▕ 20▕ $role = Role::find(1); 21▕ $permissions = Permission::where('name', 'permissions.index'); ➜ 22▕ $role->givePermissionTo($permissions); 23▕ } 24▕ } 25▕

1 D:\Software\Xampp\htdocs\helpdesk-main\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36 Database\Seeders\UserTableSeeder::run()

2 D:\Software\Xampp\htdocs\helpdesk-main\vendor\laravel\framework\src\Illuminate\Container\Util.php:40 Illuminate\Container\BoundMethod::Illuminate\Container{closure}()

zkyonsky commented 2 years ago

you need to run RolesTableSeeder.php and PermissionsTableSeeder.php first by uncomment these line below in DatabaseSeeder.php or alternatively you could just import the db_helpdesk.sql (in root folder) into your mysql database // $this->call(RolesTableSeeder::class); // $this->call(PermissionsTableSeeder::class);