user()) { $this->logUnauthorized('missing_user'); $this->denyAsNotFound(); } return true; } public function rules(): array { return [ 'title' => 'required|string|max:150', 'description' => 'nullable|string', 'category' => 'nullable|integer|exists:categories,id', 'tags' => 'nullable|string|max:200', 'license' => 'nullable|boolean', ]; } private function denyAsNotFound(): void { throw new NotFoundHttpException(); } private function logUnauthorized(string $reason): void { logger()->warning('Artwork create unauthorized access', [ 'reason' => $reason, 'user_id' => $this->user()?->id, 'ip' => $this->ip(), ]); } }