Manage clients, testimonials and talks through the API

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 19:38:58 +02:00
parent 96747abdc3
commit b02464a7ed
15 changed files with 1255 additions and 7 deletions

View File

@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace App\Http\Requests\Api\V1;
use App\Models\Client;
use App\Rules\Translatable;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
/**
* The panel's client form, as rules.
*/
class ClientRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
$client = $this->route('client');
$creating = ! $client instanceof Client;
$sometimes = $creating ? 'required' : 'sometimes';
return [
'name' => [$sometimes, 'string', 'max:255'],
'slug' => [
$sometimes,
'string',
'max:255',
'alpha_dash:ascii',
Rule::unique('clients', 'slug')->ignore($client?->id),
],
'sector' => ['sometimes', 'nullable', new Translatable(max: 120)],
'logo' => ['sometimes', 'nullable', 'string', 'max:2048'],
'url' => ['sometimes', 'nullable', 'url', 'max:2048'],
'is_public' => ['sometimes', 'boolean'],
'position' => ['sometimes', 'integer', 'min:0'],
];
}
}