ldc-gen-game-web/app/Http/Requests/Bo/Prizes/StorePrizeRequest.php
Jérémy Munsch 1774e34acd
Bo fixes
2023-11-30 11:37:17 +01:00

62 lines
1.5 KiB
PHP

<?php
namespace App\Http\Requests\Bo\Prizes;
use Illuminate\Foundation\Http\FormRequest;
class StorePrizeRequest extends FormRequest
{
/**
* 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->merge([
'need_proof' => $this->need_proof ? true : false,
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'label_one' => 'required|string|min:3|max:255',
'label_many' => 'required|string|min:3|max:255',
'arg_title' => 'required|string|min:3|max:255',
'arg_subtitle' => 'required|string|min:3|max:255',
'arg_content' => 'required|string|min:15',
'quantity' => 'required|numeric|min:1',
'pdf_winning_proof' => 'nullable|file|mimes:pdf',
'need_proof' => 'required|boolean',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'name' => trans('Nom de la page de gain'),
'file_name' => trans('Nom du fichier'),
];
}
}