optimizations

This commit is contained in:
2026-03-28 19:15:39 +01:00
parent 0b25d9570a
commit cab4fbd83e
509 changed files with 1016804 additions and 1605 deletions

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Http\Requests\Collections;
use App\Models\Collection;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCollectionPresentationRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user() !== null;
}
protected function prepareForValidation(): void
{
foreach (['subtitle', 'summary', 'theme_token'] as $field) {
if ($this->has($field) && trim((string) $this->input($field)) === '') {
$this->merge([$field => null]);
}
}
}
public function rules(): array
{
return [
'subtitle' => ['nullable', 'string', 'max:160'],
'summary' => ['nullable', 'string', 'max:320'],
'presentation_style' => ['nullable', 'in:' . implode(',', [
Collection::PRESENTATION_STANDARD,
Collection::PRESENTATION_EDITORIAL_GRID,
Collection::PRESENTATION_HERO_GRID,
Collection::PRESENTATION_MASONRY,
])],
'emphasis_mode' => ['nullable', 'in:' . implode(',', [
Collection::EMPHASIS_COVER_HEAVY,
Collection::EMPHASIS_BALANCED,
Collection::EMPHASIS_ARTWORK_FIRST,
])],
'theme_token' => ['nullable', 'in:default,subtle-blue,violet,amber'],
'layout_modules_json' => ['nullable', 'array'],
'layout_modules_json.*.key' => ['required_with:layout_modules_json', 'string', 'max:60'],
'layout_modules_json.*.enabled' => ['nullable', 'boolean'],
'layout_modules_json.*.slot' => ['nullable', 'string', 'max:20'],
];
}
}