ldc-tregalette/app/Http/Requests/Bo/KlubBlocs/UpdateKlubBlocRequest.php
2023-12-15 15:53:55 +00:00

62 lines
1.3 KiB
PHP

<?php
namespace App\Http\Requests\Bo\KlubBlocs;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class UpdateKlubBlocRequest 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(): array
{
$rules = [
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
];
return \array_merge(
$rules,
$this->pictureRules('picture', 640, 637, 640, 637, false)
);
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'picture_alt' => trans('validation.custom.attribute_alt'),
'picture_title' => trans('validation.custom.attribute_title'),
];
}
}