feat(01-02): create MemberNoteController and routes
- 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
This commit is contained in:
41
app/Http/Requests/StoreNoteRequest.php
Normal file
41
app/Http/Requests/StoreNoteRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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 字元',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user