71 lines
1.8 KiB
PHP
71 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo\Logos;
|
|
|
|
use App\Traits\Requests\HasPicture;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreLogoRequest 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 = [
|
|
'label' => 'required|string|between:3,255',
|
|
'picture_alt' => 'required|string|between:3,255',
|
|
'picture_title' => 'required|string|between:3,255',
|
|
|
|
];
|
|
return \array_merge(
|
|
$rules,
|
|
$this->pictureRules('picture', 331, 240, 331, 100, false),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'picture_alt' => __(':field :inter:model', [
|
|
'field' => __('validation.custom.alt_attribute'),
|
|
'inter' => __('validation.custom.of_the.vowel'),
|
|
'model' => __('validation.custom.picture'),
|
|
]),
|
|
'picture_title' => __(':field :inter:model', [
|
|
'field' => __('validation.custom.title_attribute'),
|
|
'inter' => __('validation.custom.of_the.vowel'),
|
|
'model' => __('validation.custom.picture'),
|
|
]),
|
|
];
|
|
}
|
|
}
|