adrema/database/factories/Form/Models/FormFactory.php

62 lines
1.7 KiB
PHP
Raw Normal View History

2023-12-27 22:54:58 +01:00
<?php
2023-12-31 22:35:13 +01:00
namespace Database\Factories\Form\Models;
2023-12-27 22:54:58 +01:00
use App\Form\Models\Form;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
2023-12-31 21:02:40 +01:00
* @extends Factory<Form>
2023-12-31 22:35:13 +01:00
* @method self name(string $name)
* @method self from(string $from)
* @method self to(string $to)
* @method self excerpt(string $excerpt)
* @method self description(string $description)
2023-12-27 22:54:58 +01:00
*/
class FormFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
2023-12-31 21:02:40 +01:00
* @var class-string<Form>
2023-12-27 22:54:58 +01:00
*/
protected $model = Form::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
2023-12-31 22:35:13 +01:00
'name' => $this->faker->words(4, true),
'description' => $this->faker->text(),
'excerpt' => $this->faker->words(10, true),
'config' => ['sections' => []],
'from' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
'to' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
'registration_from' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
'registration_until' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
'mail_top' => $this->faker->text(),
'mail_bottom' => $this->faker->text(),
2023-12-27 22:54:58 +01:00
];
}
2023-12-31 22:35:13 +01:00
/**
* @param array<int, FormtemplateSectionRequest> $sections
*/
public function sections(array $sections): self
{
return $this->state(['config.sections' => $sections]);
}
/**
* @param mixed $args
*/
public function __call($method, $parameters): self
{
return $this->state([str($method)->snake()->toString() => $parameters[0]]);
}
2023-12-27 22:54:58 +01:00
}