feat: L'Ami Fiduciaire V1.0.0 — full codebase with Story 0.1 complete
Initial commit of the L'Ami Fiduciaire SaaS platform built on Laravel 12, Vue 3, Inertia.js 2, and Tailwind CSS 4. Story 0.1 (rename folders to declarations in database) is implemented and code-reviewed: migration, rollback, and 6 Pest tests all passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
63
database/factories/ClientFactory.php
Normal file
63
database/factories/ClientFactory.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\ClientStatus;
|
||||
use App\Enums\LegalForm;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\User;
|
||||
use App\Models\Workspace;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Client>
|
||||
*/
|
||||
class ClientFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'workspace_id' => Workspace::factory(),
|
||||
'company_name' => fake()->company(),
|
||||
'legal_form' => fake()->randomElement(LegalForm::getValues()),
|
||||
'ice' => (string) fake()->numerify('##########'),
|
||||
'fiscal_id' => (string) fake()->numerify('##########'),
|
||||
'rc' => (string) fake()->numerify('######'),
|
||||
'cnss' => (string) fake()->numerify('##########'),
|
||||
'patente' => (string) fake()->numerify('########'),
|
||||
'contact_last_name' => fake()->lastName(),
|
||||
'contact_first_name' => fake()->firstName(),
|
||||
'contact_job_title' => fake()->jobTitle(),
|
||||
'contact_email' => fake()->unique()->safeEmail(),
|
||||
'contact_phone' => fake()->phoneNumber(),
|
||||
'internal_responsible_id' => null,
|
||||
'status' => ClientStatus::Active,
|
||||
'internal_notes' => fake()->optional(0.3)->sentence(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the model factory.
|
||||
*/
|
||||
public function configure(): static
|
||||
{
|
||||
return $this->afterCreating(function ($client) {
|
||||
ClientContact::factory()->principal()->create([
|
||||
'client_id' => $client->id,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate the client with an internal responsible user.
|
||||
*/
|
||||
public function withInternalResponsible(User $user): static
|
||||
{
|
||||
return $this->state(fn () => ['internal_responsible_id' => $user->id]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user