ldc-agis/app/Http/Requests/Bo/Homepage/StoreHomepageRequest.php
Nicolas Demangeat e1994588e1 added homepage
2023-10-23 10:42:57 +02:00

53 lines
1.3 KiB
PHP

<?php
namespace App\Http\Requests\Bo\Homepage;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class StoreHomepageRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->mergePicture('picture');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'title_part1' => 'required|string|between:3,255',
'title_part2' => 'required|string|between:3,255',
'title_part3' => 'required|string|between:3,255',
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'presentation_title' => 'required|string|between:3,255',
'presentation_content' => 'required|string',
];
return \array_merge(
$rules,
$this->pictureRules('picture', 640, 390, 640, 390, false),
);
}
}