Skip to content

Commit 47fb0e1

Browse files
committed
Fix UserSeeder case issue.
1 parent 1a4e27e commit 47fb0e1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Modules\User\Database\Seeders;
4+
5+
use Illuminate\Database\Seeder;
6+
use Illuminate\Support\Facades\Schema;
7+
use Modules\User\Models\User;
8+
use Spatie\Permission\Models\Role;
9+
10+
class UserSeeder extends Seeder
11+
{
12+
/**
13+
* Seed the application's database.
14+
*
15+
* @return void
16+
*/
17+
public function run()
18+
{
19+
Schema::disableForeignKeyConstraints();
20+
21+
$testUser = User::factory()->create([
22+
'name' => 'Example User',
23+
'email' => '[email protected]',
24+
'email_verified_at' => now(),
25+
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
26+
]);
27+
28+
Role::create(['name' => 'root']);
29+
30+
$testUser->assignRole('root');
31+
32+
Schema::enableForeignKeyConstraints();
33+
}
34+
}

0 commit comments

Comments
 (0)