This commit is contained in:
philipp lang 2024-01-10 21:31:34 +01:00
parent 2a6e3aac03
commit 888f4ee976
6 changed files with 18 additions and 11 deletions

View File

@ -28,10 +28,10 @@ class FormResource extends JsonResource
return [
'id' => $this->id,
'name' => $this->name,
'from_human' => $this->from?->format('d.m.Y'),
'to_human' => $this->to?->format('d.m.Y'),
'from' => $this->from?->format('Y-m-d'),
'to' => $this->to?->format('Y-m-d'),
'from_human' => $this->from->format('d.m.Y'),
'to_human' => $this->to->format('d.m.Y'),
'from' => $this->from->format('Y-m-d'),
'to' => $this->to->format('Y-m-d'),
'excerpt' => $this->excerpt,
'description' => $this->description,
'mail_top' => $this->mail_top,
@ -46,6 +46,9 @@ class FormResource extends JsonResource
];
}
/**
* @return array<string, mixed>
*/
public static function meta(): array
{
return [

View File

@ -11,6 +11,8 @@ use Tests\Feature\Form\FormtemplateSectionRequest;
* @method self name(string $name)
* @method self from(string $from)
* @method self to(string $to)
* @method self mailTop(string $content)
* @method self mailBottom(string $content)
* @method self excerpt(string $excerpt)
* @method self description(string $description)
*/
@ -53,7 +55,7 @@ class FormFactory extends Factory
}
/**
* @param mixed $args
* @param mixed $parameters
*/
public function __call($method, $parameters): self
{

View File

@ -33,11 +33,11 @@ class FormtemplateFactory extends Factory
*/
public function sections(array $sections): self
{
return $this->state(['config' => ['sections' => $sections]]);
return $this->state(['config' => ['sections' => array_map(fn ($section) => $section->create(), $sections)]]);
}
/**
* @param mixed $args
* @param mixed $parameters
*/
public function __call($method, $parameters): self
{

@ -1 +1 @@
Subproject commit b8e1cba502675df5873375bd474553b8cd197e6e
Subproject commit f76b46bc9fe159324e58783ff945595b5ba5e488

View File

@ -15,7 +15,7 @@ class FormIndexActionTest extends TestCase
public function testItDisplaysForms(): void
{
$this->login()->loginNami()->withoutExceptionHandling();
Formtemplate::factory()->name('tname')->sections([FormtemplateSectionRequest::new()->name('sname')->create()])->create();
Formtemplate::factory()->name('tname')->sections([FormtemplateSectionRequest::new()->name('sname')])->create();
$form = Form::factory()
->name('lala')
->excerpt('fff')

View File

@ -6,10 +6,12 @@ use Worksome\RequestFactories\RequestFactory;
/**
* @method self name(string $name)
* @method self from(string $date)
* @method self to(string $date)
* @method self description(string $description)
* @method self excerpt(string $description)
* @method self registrationFrom(string $date)
* @method self registrationUntil(string $date)
* @method self registrationFrom(string|null $date)
* @method self registrationUntil(string|null $date)
*/
class FormRequest extends RequestFactory
{