Files
sam-api/app/Http/Requests/Boards/PostStoreRequest.php

36 lines
964 B
PHP
Raw Normal View History

<?php
namespace App\Http\Requests\Boards;
use Illuminate\Foundation\Http\FormRequest;
class PostStoreRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'title' => 'required|string|max:200',
'content' => 'required|string',
'editor_type' => 'sometimes|string|in:wysiwyg,markdown,text',
'is_notice' => 'sometimes|boolean',
'is_secret' => 'sometimes|boolean',
'status' => 'sometimes|string|in:draft,published,hidden',
'custom_fields' => 'nullable|array',
'custom_fields.*' => 'nullable',
];
}
public function messages(): array
{
return [
'title.required' => __('validation.required', ['attribute' => '제목']),
'content.required' => __('validation.required', ['attribute' => '내용']),
];
}
}