48 lines
1.6 KiB
PHP
48 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\Claims\ClaimResponseType;
|
|
use App\Enums\Claims\ClaimStatus;
|
|
use App\Enums\Claims\ClaimType;
|
|
use App\Models\Brand;
|
|
use App\Models\Claim;
|
|
use App\Models\ClaimSubject;
|
|
use App\Models\Customer;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class ClaimFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = Claim::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'first_name' => $this->faker->firstName(),
|
|
'last_name' => $this->faker->lastName(),
|
|
'email' => $this->faker->email(),
|
|
'address' => $this->faker->optional()->address(),
|
|
'city' => $this->faker->optional()->city(),
|
|
'postcode' => $this->faker->optional()->postcode(),
|
|
'message' => $this->faker->sentence(10),
|
|
'response_type' => ClaimResponseType::none,
|
|
'type' => collect(ClaimType::toArray())->random()->value,
|
|
'status' => collect(ClaimStatus::toArray())->random()->value,
|
|
'brand_id' => $this->faker->randomElement(Brand::query()->get()->modelKeys()),
|
|
'subject_id' => $this->faker->randomElement(ClaimSubject::query()->get()->modelKeys()),
|
|
'customer_id' => $this->faker->boolean(50)
|
|
? $this->faker->randomElement(Customer::query()->get()->modelKeys())
|
|
: null,
|
|
];
|
|
}
|
|
}
|