first commit
This commit is contained in:
42
laravel/app/Http/Requests/StoreArticleRequest.php
Normal file
42
laravel/app/Http/Requests/StoreArticleRequest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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' => 'Содержание должно быть строкой.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user