- BoardController, PostController 추가 - Board, BoardSetting 모델 수정 - BoardService 추가 - FormRequest 클래스 추가 - Swagger 문서 추가 (BoardApi, PostApi) - 게시판 시스템 필드 마이그레이션 추가
43 lines
1.5 KiB
PHP
43 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Boards;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class BoardStoreRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'board_code' => 'required|string|max:50|unique:boards,board_code',
|
|
'board_type' => 'nullable|string|max:50',
|
|
'name' => 'required|string|max:100',
|
|
'description' => 'nullable|string|max:500',
|
|
'editor_type' => 'sometimes|string|in:wysiwyg,markdown,text',
|
|
'allow_files' => 'sometimes|boolean',
|
|
'max_file_count' => 'sometimes|integer|min:0|max:20',
|
|
'max_file_size' => 'sometimes|integer|min:0|max:102400',
|
|
'extra_settings' => 'nullable|array',
|
|
'extra_settings.permissions' => 'nullable|array',
|
|
'extra_settings.permissions.read' => 'nullable|array',
|
|
'extra_settings.permissions.write' => 'nullable|array',
|
|
'extra_settings.permissions.manage' => 'nullable|array',
|
|
'is_active' => 'sometimes|boolean',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'board_code.required' => __('validation.required', ['attribute' => '게시판 코드']),
|
|
'board_code.unique' => __('validation.unique', ['attribute' => '게시판 코드']),
|
|
'name.required' => __('validation.required', ['attribute' => '게시판명']),
|
|
];
|
|
}
|
|
}
|