ldc-domaine-de-lanvaux/app/Http/Requests/StoreHomepageNewscastRequest.php
Alexis Gousseau 4c39db12d7 Refonte
2022-08-05 09:38:44 +00:00

48 lines
1.1 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreHomepageNewscastRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth()->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation(): void
{
$this->merge([
'link_new_tab' => $this->link_new_tab ? true : false
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
'title' => 'required',
'picture' => 'sometimes|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=468,height=468',
'alt_text_picture' => 'required|max:255',
'text' => 'required',
'link' => 'sometimes|max:255',
'link_label' => 'sometimes|max:255',
'link_new_tab' => 'required|boolean',
];
}
}