ldc-boutique-cnc/app/Http/Requests/Bo/StaticPages/UpdateStaticPageRequest.php
Jérémy Munsch f99e259bd5
Tons of fixes Refonte SYNC 1
- Authentification System OK
2022-11-16 12:47:41 +01:00

81 lines
1.7 KiB
PHP

<?php
namespace App\Http\Requests\Bo\StaticPages;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class UpdateStaticPageRequest extends FormRequest
{
use HasPicture;
/**
* Banner width in pixel
*
* @var integer
*/
private $bannerWidth = 905;
/**
* Banner height in pixel
*
* @var integer
*/
private $bannerHeight = 505;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
return \auth('backend')->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->bannerWidth = config('theme.models.static_pages.banner_maxwidth', $this->bannerWidth);
$this->bannerHeight = config('theme.models.static_pages.banner_maxheight', $this->bannerHeight);
$this->mergePicture('banner');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return \array_merge([
'title' => 'required|string|min:3|max:255',
'value' => 'required|string'
], $this->pictureRules(
'banner',
$this->bannerWidth,
$this->bannerHeight,
$this->bannerWidth,
$this->bannerHeight,
true
));
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes()
{
return [
'title' => trans('titre'),
'banner' => trans('image bannière'),
'value' => trans('contenu'),
];
}
}