outl1ne / nova-page-manager

Static page and region manager for Laravel Nova - designed for headless CMS's.
MIT License
178 stars 38 forks source link

Not working with ebess/advanced-nova-media-library #130

Open johnpuddephatt opened 2 years ago

johnpuddephatt commented 2 years ago

Error message Call to undefined method stdClass::getMedia() shown.

The problem appears to be that the resolve function in ebess/advanced-nova-media-library expects to have been passed the model and so to be able to access methods on the model.

Whereas in the getFields method in PageManagerController in outl1ne/nova-page-manager, only the model data is passed rather than the actual model.

I would imagine this could cause problems with other fields that access model relations?

Stack trace ``` { "message": "Call to undefined method stdClass::getMedia()", "exception": "Error", "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/ebess/advanced-nova-media-library/src/Fields/Media.php", "line": 289, "trace": [ { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/nova/src/Fields/FieldCollection.php", "line": 78, "function": "resolve", "class": "Ebess\\AdvancedNovaMediaLibrary\\Fields\\Media", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php", "line": 262, "function": "Laravel\\Nova\\Fields\\{closure}", "class": "Laravel\\Nova\\Fields\\FieldCollection", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/nova/src/Fields/FieldCollection.php", "line": 80, "function": "each", "class": "Illuminate\\Support\\Collection", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/outl1ne/nova-page-manager/src/Http/Controllers/PageManagerController.php", "line": 60, "function": "resolve", "class": "Laravel\\Nova\\Fields\\FieldCollection", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Controller.php", "line": 54, "function": "getFields", "class": "Outl1ne\\PageManager\\Http\\Controllers\\PageManagerController", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php", "line": 45, "function": "callAction", "class": "Illuminate\\Routing\\Controller", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 261, "function": "dispatch", "class": "Illuminate\\Routing\\ControllerDispatcher", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 204, "function": "runController", "class": "Illuminate\\Routing\\Route", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 725, "function": "run", "class": "Illuminate\\Routing\\Route", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 141, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/outl1ne/nova-page-manager/src/Http/Middleware/AuthorizeMiddleware.php", "line": 18, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Outl1ne\\PageManager\\Http\\Middleware\\AuthorizeMiddleware", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/whitecube/nova-flexible-content/src/Http/Middleware/InterceptFlexibleAttributes.php", "line": 27, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Whitecube\\NovaFlexibleContent\\Http\\Middleware\\InterceptFlexibleAttributes", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/nova/src/Http/Middleware/BootTools.php", "line": 20, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Laravel\\Nova\\Http\\Middleware\\BootTools", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/nova/src/Http/Middleware/DispatchServingNovaEvent.php", "line": 24, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Laravel\\Nova\\Http\\Middleware\\DispatchServingNovaEvent", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/inertiajs/inertia-laravel/src/Middleware.php", "line": 92, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Inertia\\Middleware", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php", "line": 50, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php", "line": 78, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php", "line": 49, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php", "line": 121, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php", "line": 64, "function": "handleStatefulRequest", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php", "line": 37, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php", "line": 67, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 116, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 726, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 703, "function": "runRouteWithinStack", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 667, "function": "runRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 656, "function": "dispatchToRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 167, "function": "dispatch", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 141, "function": "Illuminate\\Foundation\\Http\\{closure}", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/livewire/livewire/src/DisableBrowserCache.php", "line": 19, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Livewire\\DisableBrowserCache", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/nova/src/Http/Middleware/ServeNova.php", "line": 23, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Laravel\\Nova\\Http\\Middleware\\ServeNova", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 21, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php", "line": 31, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 21, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php", "line": 40, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TrimStrings", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php", "line": 27, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php", "line": 86, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/fruitcake/laravel-cors/src/HandleCors.php", "line": 38, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Fruitcake\\Cors\\HandleCors", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php", "line": 39, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Illuminate\\Http\\Middleware\\TrustProxies", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/itsgoingd/clockwork/Clockwork/Support/Laravel/ClockworkMiddleware.php", "line": 24, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 180, "function": "handle", "class": "Clockwork\\Support\\Laravel\\ClockworkMiddleware", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 116, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 142, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 111, "function": "sendRequestThroughRouter", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/Users/johnpuddephatt/Sites/hpph2/public/index.php", "line": 52, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/Users/johnpuddephatt/.composer/vendor/laravel/valet/server.php", "line": 234, "function": "require" } ] } ```
trippo commented 1 year ago

I have the same problem, how can you manage images in your admin?

trippo commented 1 year ago

https://github.com/outl1ne/nova-media-hub

mbardelmeijer commented 1 year ago

Running into this as well. Are there any known workarounds/possible fixes for this?