user()?->isAdmin() ?? false; } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { $allowed = config('ai.allowed_models', []); return [ 'name' => ['required', 'string', 'max:120'], 'type' => ['required', 'string', 'max:40'], 'model' => ['required', 'string', Rule::in($allowed)], 'system_prompt' => ['nullable', 'string', 'max:8000'], 'current_goal' => ['nullable', 'string', 'max:2000'], 'status' => ['nullable', Rule::in(['active', 'paused', 'thinking', 'error'])], 'pos_x' => ['nullable', 'numeric', 'between:-100000,100000'], 'pos_y' => ['nullable', 'numeric', 'between:-100000,100000'], 'pos_z' => ['nullable', 'numeric', 'between:-100000,100000'], 'rotation_y' => ['nullable', 'numeric', 'between:-6.2832,6.2832'], ]; } /** * Get custom messages for validation errors. * * @return array */ public function messages(): array { return [ 'model.in' => __('validation.model_not_allowed'), ]; } }