Call to a member function getAttributeValue() on null Using Spatie Media & Translatable Plugins

when added Media & Translatable Plugins in the Resource i get error when try to upload and save the image
Call to a member function getAttributeValue() on null
Call to a member function getAttributeValue() on null
18 Replies
Dennis Koch
Dennis Koch2y ago
Share some code and the error url. Please read #✅┊rules
bennajah
bennajahOP2y ago
Here is my code @Dennis Koch https://github.com/PterodactylStore/filament-test Look at PostResource
GitHub
GitHub - PterodactylStore/filament-test
Contribute to PterodactylStore/filament-test development by creating an account on GitHub.
bennajah
bennajahOP2y ago
Any solution?
Dennis Koch
Dennis Koch2y ago
Hm. I don’t know sorry
awcodes
awcodes2y ago
Can you share the flare url?
bennajah
bennajahOP2y ago
What's flare url
bennajah
bennajahOP2y ago
GitHub
Call to a member function getAttributeValue() on null Using Spatie ...
Package filament/spatie-laravel-media-library-plugin Package Version v3.0.27 Laravel Version v10.18.0 Livewire Version v3.0.0-beta.9 PHP Version PHP 8.2.8 Problem description Recording.2023-08-20.0...
Dennis Koch
Dennis Koch2y ago
Flare is Laravels error screen and you can hit the share button there. See #✅┊rules
bennajah
bennajahOP2y ago
Flare
Call to a member function getAttributeValue() on null - The error occurred at http://127.0.0.1:8001/admin/posts/1/edit
bennajah
bennajahOP2y ago
Help?
awcodes
awcodes2y ago
For some reason the media object is null like it’s not getting attached to the record. Did you follow all the steps for spatie media library itself (not the plugin) to setup your model?
bennajah
bennajahOP2y ago
Yes I think because I'm using spatie translatable I try without translatable plugin and it's work And this error appear only if I use spatie media library and translatable both in same resource I have also included my repo that reproduce the error
bennajah
bennajahOP2y ago
https://github.com/PterodactylStore/filament-test/blob/main/app/Models/Post.php The post model is correct following the docs for both packages
GitHub
filament-test/app/Models/Post.php at main · PterodactylStore/filame...
Contribute to PterodactylStore/filament-test development by creating an account on GitHub.
bennajah
bennajahOP2y ago
any idea how i can combine both spatie plugins without the mentioned error ?
awcodes
awcodes2y ago
I honestly don’t know. I’d recommend reaching out on one of the Spatie packages repos to see what they recommend for having them work together.
bennajah
bennajahOP2y ago
I have already try to add image manually to database for each translatable post and display the post with images And is works So the problem filament plugin can't Handel adding the media image to database when translatable plugin is enabled
awcodes
awcodes2y ago
There is a bug in the Translatable Plugin. You can follow it at https://github.com/filamentphp/filament/issues/7591
GitHub
Translatable resource with media bug · Issue #7591 · filamentphp/fi...
Package filament/spatie-laravel-translatable-plugin Package Version v3.0.13 Laravel Version v10.18.0 Livewire Version v3.0.0-beta.8 PHP Version PHP 8.2.8 Problem description Editing translatable re...
bennajah
bennajahOP2y ago
Okay thank you 👍

Did you find this page helpful?