{"record":{"id":"b21317b5cb6bd86d","repo":"filamentphp/filament","slug":"the-static-class-requires-the-model-to-implem","errorCode":null,"errorMessage":"The [{static::class}] requires the model to implement the [{HasMedia::class}] interface from the Spatie Media Library package.","messagePattern":"The \\[(.+?)\\] requires the model to implement the \\[(.+?)\\] interface from the Spatie Media Library package\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"packages/spatie-laravel-media-library-plugin/src/Forms/Components/RichEditor/FileAttachmentProviders/SpatieMediaLibraryFileAttachmentProvider.php","lineNumber":87,"sourceCode":"    }\n\n    public function attribute(RichContentAttribute $attribute): static\n    {\n        $this->attribute = $attribute;\n\n        return $this;\n    }\n\n    public function getExistingModel(): ?HasMedia\n    {\n        $model = $this->attribute->getModel();\n\n        if (! $model->exists) {\n            return null;\n        }\n\n        if (! ($model instanceof HasMedia)) {\n            throw new LogicException('The [' . static::class . '] requires the model to implement the [' . HasMedia::class . '] interface from the Spatie Media Library package.');\n        }\n\n        return $model;\n    }\n\n    public function getMedia(): ?MediaCollection\n    {\n        if ($this->media) {\n            return $this->media;\n        }\n\n        /** @var ?MediaCollection $media */\n        $media = $this->getExistingModel()?->getMedia($this->getCollection())->keyBy('uuid');\n\n        return $this->media = $media;\n    }\n\n    public function getFileAttachmentUrl(mixed $file): ?string","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/filamentphp/filament/blob/53483fa9340e4ec637985fe454ebb58afb92ea24/packages/spatie-laravel-media-library-plugin/src/Forms/Components/RichEditor/FileAttachmentProviders/SpatieMediaLibraryFileAttachmentProvider.php#L69-L105","documentation":"Error \"The [{static::class}] requires the model to implement the [{HasMedia::class}] interface from the Spatie Media Library package.\" thrown in filamentphp/filament.","triggerScenarios":"Thrown at packages/spatie-laravel-media-library-plugin/src/Forms/Components/RichEditor/FileAttachmentProviders/SpatieMediaLibraryFileAttachmentProvider.php:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53483fa9340e4ec637985fe454ebb58afb92ea24","analyzedAt":"2026-08-17T02:06:23.049Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}