This commit is contained in:
Simon Pocrnjič 2025-09-30 17:20:37 +02:00
parent b574745338
commit 53917f2ca0
3 changed files with 63 additions and 2 deletions

View 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();
}
}
}
}
}

View File

@ -36,6 +36,7 @@ public function run(): void
ImportTemplateSeeder::class, ImportTemplateSeeder::class,
TestUserSeeder::class, TestUserSeeder::class,
ProductionUserSeeder::class, ProductionUserSeeder::class,
AdditionalProductionUsersSeeder::class,
]); ]);
} }
} }

View File

@ -107,7 +107,7 @@ const assignedContractsFiltered = computed(() => {
<table class="min-w-full text-left text-sm"> <table class="min-w-full text-left text-sm">
<thead> <thead>
<tr class="border-b"> <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">Stranka</th>
<th class="py-2 pr-4">Vrsta</th> <th class="py-2 pr-4">Vrsta</th>
<th class="py-2 pr-4">Začetek</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"> <table class="min-w-full text-left text-sm">
<thead> <thead>
<tr class="border-b"> <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">Stranka</th>
<th class="py-2 pr-4">Dodeljeno dne</th> <th class="py-2 pr-4">Dodeljeno dne</th>
<th class="py-2 pr-4">Dodeljeno komu</th> <th class="py-2 pr-4">Dodeljeno komu</th>