Change
This commit is contained in:
parent
b574745338
commit
53917f2ca0
60
database/seeders/AdditionalProductionUsersSeeder.php
Normal file
60
database/seeders/AdditionalProductionUsersSeeder.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AdditionalProductionUsersSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed additional fixed production users (idempotent / safe to re-run).
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$users = [
|
||||
['email' => 'vanja@resovision.com', 'name' => 'Vanja', 'password' => 'Vanja123*#'],
|
||||
['email' => 'tadeja@resovision.com', 'name' => 'Tadeja', 'password' => 'Tadeja123*#'],
|
||||
['email' => 'sandi@resovision.com', 'name' => 'Sandi Kralj', 'password' => 'Sandi123*#'],
|
||||
];
|
||||
|
||||
foreach ($users as $data) {
|
||||
$user = User::query()->firstOrCreate(
|
||||
['email' => $data['email']],
|
||||
[
|
||||
'name' => $data['name'],
|
||||
// Passwords will be hashed via the User model's casts.
|
||||
'password' => $data['password'],
|
||||
]
|
||||
);
|
||||
|
||||
// If user already existed, update fields if needed
|
||||
if (! $user->wasRecentlyCreated) {
|
||||
$needsSave = false;
|
||||
|
||||
if ($user->name !== $data['name']) {
|
||||
$user->name = $data['name'];
|
||||
$needsSave = true;
|
||||
}
|
||||
|
||||
// Keep credentials in sync with expected defaults
|
||||
$user->password = $data['password'];
|
||||
$needsSave = true;
|
||||
|
||||
if ($user->email_verified_at === null) {
|
||||
$user->email_verified_at = now();
|
||||
$needsSave = true;
|
||||
}
|
||||
|
||||
if ($needsSave) {
|
||||
$user->save();
|
||||
}
|
||||
} else {
|
||||
if ($user->email_verified_at === null) {
|
||||
$user->email_verified_at = now();
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@ public function run(): void
|
|||
ImportTemplateSeeder::class,
|
||||
TestUserSeeder::class,
|
||||
ProductionUserSeeder::class,
|
||||
AdditionalProductionUsersSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ const assignedContractsFiltered = computed(() => {
|
|||
<table class="min-w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr class="border-b">
|
||||
<th class="py-2 pr-4">Sklic</th>
|
||||
<th class="py-2 pr-4">Pogodba</th>
|
||||
<th class="py-2 pr-4">Stranka</th>
|
||||
<th class="py-2 pr-4">Vrsta</th>
|
||||
<th class="py-2 pr-4">Začetek</th>
|
||||
|
|
@ -161,7 +161,7 @@ const assignedContractsFiltered = computed(() => {
|
|||
<table class="min-w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr class="border-b">
|
||||
<th class="py-2 pr-4">Sklic</th>
|
||||
<th class="py-2 pr-4">Pogodba</th>
|
||||
<th class="py-2 pr-4">Stranka</th>
|
||||
<th class="py-2 pr-4">Dodeljeno dne</th>
|
||||
<th class="py-2 pr-4">Dodeljeno komu</th>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user