<?php
 namespace App\Http\Requests\Admin; use App\Models\TicketPredefinedReply; use Illuminate\Foundation\Http\FormRequest; class TicketPredefinedReplyStoreRequest extends FormRequest { public function authorize(): bool { return $this->user()->can('create', TicketPredefinedReply::class); } public function rules(): array { return [ 'title' => 'required|string|max:255', 'content' => 'required|string', 'department_ids' => 'nullable|array', 'department_ids.*' => 'exists:ticket_departments,id', 'role_ids' => 'nullable|array', 'role_ids.*' => 'exists:roles,id', 'status' => 'boolean', 'translations' => 'array', 'translations.*.title' => 'nullable|string|max:255', 'translations.*.content' => 'nullable|string', ]; } public function messages(): array { return [ 'title.required' => __('admin/validation.ticket_predefined_reply_title_required'), 'title.max' => __('admin/validation.ticket_predefined_reply_title_max'), 'content.required' => __('admin/validation.ticket_predefined_reply_content_required'), 'department_ids.array' => __('admin/validation.ticket_predefined_reply.department_ids_array'), 'department_ids.*.exists' => __('admin/validation.ticket_predefined_reply_department_ids_exists'), 'role_ids.array' => __('admin/validation.ticket_predefined_reply.role_ids_array'), 'role_ids.*.exists' => __('admin/validation.ticket_predefined_reply_role_ids_exists'), ]; } } 