adrema/app/Form/Resources/FormtemplateResource.php

60 lines
1.4 KiB
PHP
Raw Normal View History

2023-12-22 20:40:24 +01:00
<?php
namespace App\Form\Resources;
use App\Lib\HasMeta;
use Illuminate\Http\Resources\Json\JsonResource;
class FormtemplateResource extends JsonResource
{
use HasMeta;
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array<string, mixed>
*/
public function toArray($request)
{
return parent::toArray($request);
}
/**
* @return array<string, mixed>
*/
public static function meta(): array
{
return [
'fields' => [
[
'id' => 'TextField',
'name' => 'Text',
2023-12-25 19:35:00 +01:00
'default' => [
'name' => '',
'type' => 'TextField',
'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 12],
'default' => '',
'required' => false,
]
2023-12-22 20:40:24 +01:00
]
],
'links' => [
'store' => route('formtemplate.store'),
],
'default' => [
'name' => '',
'config' => [
'sections' => [],
]
],
'section_default' => [
2023-12-25 19:35:00 +01:00
'name' => '',
'intro' => '',
2023-12-22 20:40:24 +01:00
'fields' => [],
]
];
}
}