2025-11-30 21:05:33 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Boards;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
|
|
|
|
|
class BoardUpdateRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
$boardId = $this->route('id');
|
2025-12-27 18:27:19 +09:00
|
|
|
$tenantId = auth()->user()?->current_tenant_id;
|
2025-11-30 21:05:33 +09:00
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'board_code' => [
|
|
|
|
|
'sometimes',
|
|
|
|
|
'string',
|
|
|
|
|
'max:50',
|
2025-12-27 18:27:19 +09:00
|
|
|
// 테넌트 게시판 내에서만 중복 체크 (시스템 게시판과는 중복 허용)
|
|
|
|
|
Rule::unique('boards', 'board_code')
|
|
|
|
|
->ignore($boardId)
|
|
|
|
|
->where('tenant_id', $tenantId),
|
2025-11-30 21:05:33 +09:00
|
|
|
],
|
|
|
|
|
'board_type' => 'nullable|string|max:50',
|
|
|
|
|
'name' => 'sometimes|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',
|
2025-12-27 18:27:19 +09:00
|
|
|
'extra_settings.target' => 'nullable|string|in:all,department',
|
|
|
|
|
'extra_settings.target_id' => 'nullable|integer',
|
|
|
|
|
'extra_settings.target_name' => 'nullable|string|max:100',
|
2025-11-30 21:05:33 +09:00
|
|
|
'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.unique' => __('validation.unique', ['attribute' => '게시판 코드']),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|