ldc-gen-game-web/app/Http/Requests/Bo/FaqQuestions/StoreFaqQuestionRequest.php

47 lines
1,011 B
PHP
Raw Normal View History

2023-08-22 09:18:39 +02:00
<?php
namespace App\Http\Requests\Bo\FaqQuestions;
use Illuminate\Foundation\Http\FormRequest;
class StoreFaqQuestionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
2023-11-30 11:37:17 +01:00
return auth('backend')->check();
2023-08-22 09:18:39 +02:00
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'question' => 'required|string|min:3|max:255',
'answer' => 'required|string|min:3|max:255',
'theme_id' => 'required|exists:faq_themes,id',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'question' => trans('Question'),
'answer' => trans('Réponse'),
'theme_id' => trans('Thème associé'),
];
}
}