feat: implement product attribute options with database migration, resource, and validation requests
This commit is contained in:
@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Fillable([
|
||||
'attribute_id',
|
||||
'value',
|
||||
'label',
|
||||
'sort_order',
|
||||
'metadata',
|
||||
|
||||
@@ -43,6 +43,7 @@ class StoreProductAttributeRequest extends FormRequest
|
||||
], true)),
|
||||
'array',
|
||||
],
|
||||
'options.*.value' => ['required', 'string', 'max:255'],
|
||||
'options.*.label' => ['required', 'string', 'max:255'],
|
||||
'options.*.sort_order' => ['sometimes', 'integer'],
|
||||
'options.*.metadata' => ['nullable', 'array'],
|
||||
|
||||
@@ -37,6 +37,7 @@ class UpdateProductAttributeRequest extends FormRequest
|
||||
'metadata_schema' => ['nullable', 'array'],
|
||||
'type' => ['required', Rule::enum(FieldType::class)],
|
||||
'options' => ['sometimes', 'array'],
|
||||
'options.*.value' => ['required', 'string', 'max:255'],
|
||||
'options.*.label' => ['required', 'string', 'max:255'],
|
||||
'options.*.sort_order' => ['sometimes', 'integer'],
|
||||
'options.*.metadata' => ['nullable', 'array'],
|
||||
|
||||
@@ -17,6 +17,7 @@ class ProductAttributeOptionResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'value' => $this->value,
|
||||
'label' => $this->label,
|
||||
'sort_order' => $this->sort_order,
|
||||
'metadata' => $this->metadata,
|
||||
|
||||
Reference in New Issue
Block a user