@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Creates local-only account examples for management UI and access-control exercises.
|
||||
* These accounts are deliberately unverified, have no MFA, and are not added to the
|
||||
* configured portal manager allowlist.
|
||||
*/
|
||||
class SampleManagerAccountsSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
if (! app()->environment(['local', 'testing'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (range(1, 10) as $number) {
|
||||
$suffix = str_pad((string) $number, 2, '0', STR_PAD_LEFT);
|
||||
|
||||
$user = User::firstOrCreate(
|
||||
['email' => "gestor{$suffix}@example.test"],
|
||||
[
|
||||
'name' => "Gestor de Exemplo {$suffix}",
|
||||
'password' => Str::random(48),
|
||||
],
|
||||
);
|
||||
|
||||
if ($user->wasRecentlyCreated) {
|
||||
$user->forceFill([
|
||||
'email_verified_at' => null,
|
||||
'two_factor_secret' => null,
|
||||
'two_factor_recovery_codes' => null,
|
||||
'two_factor_confirmed_at' => null,
|
||||
])->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user