changes 0328092025

This commit is contained in:
Simon Pocrnjič
2025-09-28 22:36:47 +02:00
parent b40ee9dcde
commit 7e8e0a479b
61 changed files with 4306 additions and 654 deletions
+4 -1
View File
@@ -2,6 +2,8 @@
namespace Database\Factories;
use App\Models\Client;
use App\Models\Person\Person;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
@@ -17,7 +19,8 @@ class ClientCaseFactory extends Factory
public function definition(): array
{
return [
//
'client_id' => Client::factory(),
'person_id' => Person::factory(),
];
}
}
+3 -1
View File
@@ -2,6 +2,7 @@
namespace Database\Factories;
use App\Models\Person\Person;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
@@ -17,7 +18,8 @@ class ClientFactory extends Factory
public function definition(): array
{
return [
//
'person_id' => Person::factory(),
'active' => 1,
];
}
}
+8 -1
View File
@@ -2,6 +2,8 @@
namespace Database\Factories;
use App\Models\ClientCase;
use App\Models\ContractType;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
@@ -17,7 +19,12 @@ class ContractFactory extends Factory
public function definition(): array
{
return [
//
'reference' => $this->faker->optional()->bothify('REF-####'),
'start_date' => $this->faker->date(),
'end_date' => $this->faker->optional()->date(),
'client_case_id' => ClientCase::factory(),
'type_id' => ContractType::factory(),
'description' => $this->faker->optional()->sentence(),
];
}
}
@@ -0,0 +1,19 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ContractType>
*/
class ContractTypeFactory extends Factory
{
public function definition(): array
{
return [
'name' => $this->faker->unique()->word(),
'description' => $this->faker->optional()->sentence(),
];
}
}
+2 -1
View File
@@ -17,7 +17,8 @@ class DecisionFactory extends Factory
public function definition(): array
{
return [
//
'name' => $this->faker->unique()->words(2, true),
'color_tag' => $this->faker->optional()->safeColorName(),
];
}
}
+6 -3
View File
@@ -2,6 +2,8 @@
namespace Database\Factories\Person;
use App\Models\Person\PersonGroup;
use App\Models\Person\PersonType;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
@@ -19,13 +21,14 @@ public function definition(): array
return [
'first_name' => $this->faker->firstName(),
'last_name' => $this->faker->lastName(),
'full_name' => fn(array $attrs) => trim(($attrs['first_name'] ?? '').' '.($attrs['last_name'] ?? '')),
'gender' => $this->faker->randomElement(['m','w']),
'full_name' => fn (array $attrs) => trim(($attrs['first_name'] ?? '').' '.($attrs['last_name'] ?? '')),
'gender' => $this->faker->randomElement(['m', 'w']),
'birthday' => $this->faker->optional()->date(),
'tax_number' => $this->faker->optional()->bothify('########'),
'social_security_number' => $this->faker->optional()->bothify('#########'),
'description' => $this->faker->optional()->sentence(),
// group_id/type_id are required; keep null here and let tests/seeds assign or rely on defaults in code paths that use factories
'group_id' => PersonGroup::factory(),
'type_id' => PersonType::factory(),
];
}
}
@@ -9,15 +9,12 @@
*/
class PersonGroupFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
'name' => $this->faker->unique()->word(),
'description' => $this->faker->optional()->sentence(),
'color_tag' => $this->faker->optional()->safeColorName(),
];
}
}
@@ -17,7 +17,8 @@ class PersonTypeFactory extends Factory
public function definition(): array
{
return [
//
'name' => $this->faker->unique()->word(),
'description' => $this->faker->optional()->sentence(),
];
}
}
+3 -1
View File
@@ -17,7 +17,9 @@ class SegmentFactory extends Factory
public function definition(): array
{
return [
//
'name' => $this->faker->unique()->words(2, true),
'description' => $this->faker->sentence(),
'active' => true,
];
}
}