feat: add admin seeder and is_admin factory state

Runs is_admin migration, adds AdminSeeder for the admin user, registers
it in DatabaseSeeder, adds admin() factory state to UserFactory, and
adds AdminAccessTest covering both forbidden and ok cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ovidiu U
2026-04-04 13:54:28 +01:00
parent a0e74f2363
commit cde3a27cff
4 changed files with 51 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class AdminSeeder extends Seeder
{
public function run(): void
{
User::updateOrCreate(
['email' => 'uovidiu@sent.com'],
[
'name' => 'Ovidiu U',
'password' => Hash::make('changeme'),
'is_admin' => true,
]
);
}
}