2023-10-24 15:15:55 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Bo\Testimonials;
|
|
|
|
|
|
|
|
|
|
use App\Traits\Requests\HasPicture;
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
|
|
class StoreTestimonialRequest 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 = [
|
|
|
|
|
'picture_alt' => 'required|string|between:3,255',
|
|
|
|
|
'picture_title' => 'required|string|between:3,255',
|
|
|
|
|
'description' => 'required|string|between:3,255',
|
|
|
|
|
'job' => 'required|string|between:3,255',
|
|
|
|
|
'statut' => 'required|string|between:3,255',
|
|
|
|
|
];
|
|
|
|
|
return \array_merge(
|
|
|
|
|
$rules,
|
|
|
|
|
$this->pictureRules('picture', 292, 417, 292, 417, false),
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-11-06 12:57:17 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get custom attributes for validator errors.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function attributes(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'picture_alt' => trans('validation.custom.picture_alt', ['field' => __('validation.custom.picture')]),
|
|
|
|
|
'picture_title' => trans('validation.custom.picture_title', ['field' => __('validation.custom.picture')]),
|
|
|
|
|
'description' => trans('validation.attributes.description'),
|
|
|
|
|
'job' => trans('validation.custom.job'),
|
|
|
|
|
'statut' => trans('validation.custom.statut'),
|
|
|
|
|
];
|
|
|
|
|
}
|
2023-10-24 15:15:55 +02:00
|
|
|
}
|