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

49 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2023-08-22 09:18:39 +02:00
<?php
namespace App\Http\Requests\Bo\FaqQuestions;
2023-12-05 12:33:25 +01:00
use App\Models\FaqQuestion;
2023-08-22 09:18:39 +02:00
use Illuminate\Foundation\Http\FormRequest;
2023-12-05 12:33:25 +01:00
use Illuminate\Support\Facades\Gate;
2023-08-22 09:18:39 +02:00
class StoreFaqQuestionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
2023-12-05 12:33:25 +01:00
return Gate::check('create', FaqQuestion::class);
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',
2023-12-05 12:33:25 +01:00
'answer' => 'required|string|min:3',
2023-08-22 09:18:39 +02:00
'theme_id' => 'required|exists:faq_themes,id',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
2023-11-30 16:58:36 +01:00
'question' => trans('validation.custom.question'),
'answer' => trans('validation.custom.answer'),
'theme_id' => trans_choice('models.classes.faq-themes', 1),
2023-08-22 09:18:39 +02:00
];
}
}