- MemberNoteController with index() and store() methods - StoreNoteRequest with Traditional Chinese validation messages - Routes registered at admin.members.notes.index/store - JSON responses for AJAX consumption in Phase 2 - DB::transaction wrapper with AuditLogger::log
42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreNoteRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
// Authorization is handled by the admin middleware on the route group
|
|
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 [
|
|
'content' => ['required', 'string', 'min:1', 'max:65535'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'content.required' => '備忘錄內容為必填欄位',
|
|
'content.min' => '備忘錄內容不可為空白',
|
|
'content.max' => '備忘錄內容不可超過 65535 字元',
|
|
];
|
|
}
|
|
}
|