35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class TestimonialRequest extends FormRequest
|
|
{
|
|
/**
|
|
* An unchecked checkbox is not submitted, so treat it as unpublished.
|
|
*/
|
|
protected function prepareForValidation(): void
|
|
{
|
|
$this->merge(['is_published' => $this->boolean('is_published')]);
|
|
}
|
|
|
|
/**
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'quote_id' => ['required', 'string', 'max:2000'],
|
|
'quote_en' => ['required', 'string', 'max:2000'],
|
|
'role_id' => ['required', 'string', 'max:255'],
|
|
'role_en' => ['required', 'string', 'max:255'],
|
|
'organization_id' => ['required', 'string', 'max:255'],
|
|
'organization_en' => ['required', 'string', 'max:255'],
|
|
'is_published' => ['boolean'],
|
|
'sort_order' => ['required', 'integer', 'min:0'],
|
|
];
|
|
}
|
|
}
|