base commit
This commit is contained in:
34
database/factories/EmployeeDocumentFactory.php
Normal file
34
database/factories/EmployeeDocumentFactory.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user