Files
test_polis/laravel/app/Http/Requests/StoreArticleRequest.php
2026-02-04 23:23:42 +07:00

43 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
final class StoreArticleRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'title' => 'required|string|max:255',
'content' => 'required|string',
];
}
public function messages(): array
{
return [
'title.required' => 'Заголовок статьи обязателен.',
'title.string' => 'Заголовок должен быть строкой.',
'title.max' => 'Заголовок не может быть длиннее 255 символов.',
'content.required' => 'Содержание статьи обязательно.',
'content.string' => 'Содержание должно быть строкой.',
];
}
}