35 lines
826 B
PHP
35 lines
826 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\DocumentType;
|
|
use App\Models\Employee;
|
|
use App\Models\EmployeeDocument;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<EmployeeDocument>
|
|
*/
|
|
class EmployeeDocumentFactory extends Factory
|
|
{
|
|
protected $model = EmployeeDocument::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$type = fake()->randomElement(DocumentType::cases());
|
|
|
|
return [
|
|
'employee_id' => Employee::factory(),
|
|
'document_type' => $type,
|
|
'title' => $type->label().' - '.fake()->word(),
|
|
'file_path' => 'documents/'.fake()->uuid().'.pdf',
|
|
'uploaded_at' => fake()->dateTimeBetween('-1 year', 'now'),
|
|
];
|
|
}
|
|
}
|