Skip to content

Commit

Permalink
Add seeder info to README and update DatabaseSeeder
Browse files Browse the repository at this point in the history
This commit adds default seeder user information in the README document for clear access details to new developers. It also updates the DatabaseSeeder with password assignment and creation of a non-super admin user.
  • Loading branch information
marco-introini committed Dec 21, 2023
1 parent 021e4d7 commit 8f514d0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ There are two panels:
- admin panels for users (/admin) to upload images
- super admin panel (/super-admin) for user administration

## Seeder

The default seeder create the following users:

- SUPER ADMIN: admin@example.com password: password
- ADMIN: demo@example.com password: password

## PHPStan

Analyzed with level 9
11 changes: 11 additions & 0 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Models\Activity;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class DatabaseSeeder extends Seeder
{
Expand All @@ -19,10 +20,20 @@ public function run(): void
'name' => 'Test Super Admin',
'email' => 'test@example.com',
'email_verified_at' => now(),
'password' => Hash::make('password')
]);
$superAdmin->super_admin = true;
$superAdmin->save();

User::factory()->create([
'username' => 'demo',
'name' => 'demo',
'email' => 'demo@example.com',
'email_verified_at' => now(),
'super_admin' => false,
'password' => Hash::make('password')
]);

User::factory(10)->create();

Activity::factory(20)->create();
Expand Down

0 comments on commit 8f514d0

Please sign in to comment.