whitecube / nova-page Goto Github PK
View Code? Open in Web Editor NEWStatic pages content management for Laravel Nova
Home Page: https://whitecube.github.io/nova-page
License: MIT License
Static pages content management for Laravel Nova
Home Page: https://whitecube.github.io/nova-page
License: MIT License
i have a template like this:
namespace App\Nova\Templates;
use Whitecube\NovaPage\Pages\Template;
class Home extends Template
{
/**
* The JSON attributes that should be automatically decoded
*
* @var array
*/
protected $jsonAttributes = ['title', 'body'];
}
But when i call it i get
json_decode() expects parameter 1 to be string, array given
Error occured here
//vendor/whitecube/nova-page/src/Sources/Database.php
$model = $this->getOriginal($template);
if(!$model->id) {
return;
}
// dd($model->attributes);
$attributes = $this->getParsedAttributes(
$template,
$model->attributes ? json_decode($model->attributes, true) : []
);
return [
'title' => $model->title,
'created_at' => $model->created_at,
'updated_at' => $model->updated_at,
'attributes' => $attributes
];
Hi, thank you so much for the great package.
I wasn't able to install it correctly on Laravel 5.8 and Nova 2.0.0, the package:discover command returns this error after doing a composer update:
In Container.php line 794: Class blade.compiler does not exist
I tried digging into it but couldn't find anything relevant. In the meantime I'll use a 5.7 environment.
Thanks again!
It's been awhile since i've used Nova, updated from 2.0.6 to 2.9.4 this morning.
Laravel: 5.8
Laravel Nova: 2.9.4
Laravel Nova-Page: 0.2.3
Somehow, the new pages(none are existant for the moment) are not showing up when I created one through Php artisan.
Is there some change? I've followed the doc and i'm storing in the database. My table "static_pages" is still there although it's empty from my previous usage when I was on 2.0.6.
Small update: The new pages are just not getting added to the Database, at all. Files are being created, but not added to the database(Yes, my database config is working.)
2nd update: Completely removed any refererences of the package in my whole Laravel project. Did a fresh install of the package, still won't add to the Database. I can confirm, that Nova has access to my Database content. So it's not the connection or database config.
Any clues?
I'm trying to set an IF statement around the fields pulled through Nova-page tool
e.g @if (!empty(Page::get('sub_title'))))
But everything I'm trying just seems to be ignored and Laravel throws an error if the field is left empty.
Hi there!
This package looks terrific -- kudos for putting it out.
Have you thought about supporting caching? Something where we could set a default TTL in a config would be fantastic. On the Nova end it would have to bust that cache up update as well.
If it's possible to implement this manually, e.g. at the controller level, could you please let me know how? I planned to cook it up myself and submit a PR with documentation, but at first glance through the source and documentation, I couldn't come up with a way to do it.
When saving a new option, it requires a "title". Nothing is saving to the DB table resulting in a Not null error.
v^0.2.3
When trying to save a new page, it will successfully create the appropriate json
file, but only if the resources/lang/xx/route
folder already exists.
If it doesn't exist, Nova throws an error.
Hi,
We are not able to create instances of any resource through Nova that has a MorphTo
field on it, as long as the Whitecube\NovaPage\NovaPageTool
is registered in the NovaServiceProvider. The create form is not even loaded.
When we deactivate the tool, everything works fine.
The following exception is thrown:
Access to undeclared static property: Whitecube\NovaPage\Pages\Resource::$model {"userId":1,"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Access to undeclared static property: Whitecube\\NovaPage\\Pages\\Resource::$model at /var/www/nova/src/Nova.php:320)
[stacktrace]
#0 [internal function]: Laravel\\Nova\\Nova::Laravel\\Nova\\{closure}('Whitecube\\\\NovaP...', 34)
#1 /var/www/vendor/laravel/framework/src/Illuminate/Support/Arr.php(175): call_user_func(Object(Closure), 'Whitecube\\\\NovaP...', 34)
#2 /var/www/vendor/laravel/framework/src/Illuminate/Support/Collection.php(759): Illuminate\\Support\\Arr::first(Array, Object(Closure), NULL)
#3 /var/www/nova/src/Nova.php(321): Illuminate\\Support\\Collection->first(Object(Closure))
#4 /var/www/nova/src/Fields/MorphTo.php(199): Laravel\\Nova\\Nova::resourceForModel(NULL)
#5 /var/www/nova/src/Fields/MorphTo.php(159): Laravel\\Nova\\Fields\\MorphTo->resolveMorphType(Object(App\\ClientAgent))
#6 /var/www/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php(60): Laravel\\Nova\\Fields\\MorphTo->resolve(Object(App\\ClientAgent))
#7 /var/www/vendor/laravel/framework/src/Illuminate/Support/Collection.php(419): Illuminate\\Support\\HigherOrderCollectionProxy->Illuminate\\Support\\{closure}(Object(Laravel\\Nova\\Fields\\MorphTo), 1)
#8 /var/www/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php(61): Illuminate\\Support\\Collection->each(Object(Closure))
#9 /var/www/nova/src/ResolvesFields.php(179): Illuminate\\Support\\HigherOrderCollectionProxy->__call('resolve', Array)
#10 /var/www/nova/src/ResolvesFields.php(86): Laravel\\Nova\\Resource->resolveFields(Object(Laravel\\Nova\\Http\\Requests\\NovaRequest), Object(Closure))
#11 /var/www/nova/src/Http/Controllers/CreationFieldController.php(23): Laravel\\Nova\\Resource->creationFields(Object(Laravel\\Nova\\Http\\Requests\\NovaRequest))
#12 [internal function]: Laravel\\Nova\\Http\\Controllers\\CreationFieldController->index(Object(Laravel\\Nova\\Http\\Requests\\NovaRequest), 'client-agents')
#13 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#14 /var/www/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('index', Array)
#15 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Laravel\\Nova\\Http\\Controllers\\CreationFieldController), 'index')
#16 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\\Routing\\Route->runController()
#17 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(680): Illuminate\\Routing\\Route->run()
#18 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#19 /var/www/nova/src/Http/Middleware/Authorize.php(18): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#20 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Laravel\\Nova\\Http\\Middleware\\Authorize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /var/www/nova/src/Http/Middleware/BootTools.php(20): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Laravel\\Nova\\Http\\Middleware\\BootTools->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 /var/www/nova/src/Http/Middleware/DispatchServingNovaEvent.php(20): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Laravel\\Nova\\Http\\Middleware\\DispatchServingNovaEvent->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 /var/www/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /var/www/nova/src/Http/Middleware/Authenticate.php(31): Illuminate\\Auth\\Middleware\\Authenticate->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Laravel\\Nova\\Http\\Middleware\\Authenticate->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 /var/www/vendor/whitecube/nova-page/src/Http/Middleware/LoadPageForCurrentRoute.php(40): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#33 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Whitecube\\NovaPage\\Http\\Middleware\\LoadPageForCurrentRoute->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#34 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#35 /var/www/app/Http/Middleware/IsDeactivated.php(34): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#36 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): App\\Http\\Middleware\\IsDeactivated->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#37 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#38 /var/www/app/Http/Middleware/Timezone.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#39 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): App\\Http\\Middleware\\Timezone->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 /var/www/vendor/laravel/passport/src/Http/Middleware/CreateFreshApiToken.php(50): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#42 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Laravel\\Passport\\Http\\Middleware\\CreateFreshApiToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#43 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#44 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#45 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#47 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(75): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#48 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 /var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php(58): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#51 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Session\\Middleware\\AuthenticateSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /var/www/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#54 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 /var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#57 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 /var/www/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#60 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#61 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#62 /var/www/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#63 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#64 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#65 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#66 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(682): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#67 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(657): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#68 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(623): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#69 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(612): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#70 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#71 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#72 /var/www/vendor/kabbouchi/nova-impersonate/src/Http/Middleware/Impersonate.php(24): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#73 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): KABBOUCHI\\NovaImpersonate\\Http\\Middleware\\Impersonate->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#74 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#75 /var/www/nova/src/Http/Middleware/ServeNova.php(26): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#76 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Laravel\\Nova\\Http\\Middleware\\ServeNova->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#77 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#78 /var/www/vendor/beyondcode/laravel-view-xray/src/XrayMiddleware.php(28): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#79 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): BeyondCode\\ViewXray\\XrayMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#80 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#81 /var/www/vendor/beyondcode/laravel-query-detector/src/QueryDetectorMiddleware.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#82 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): BeyondCode\\QueryDetector\\QueryDetectorMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#83 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#84 /var/www/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#85 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#86 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#87 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#88 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#89 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#90 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#91 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#92 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#93 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#94 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#95 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#96 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#97 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#98 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#99 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#100 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#101 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#102 /var/www/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#103 {main}
"}
Seem to have an issue with signing into the Nova dashboard after adding this package. I have a guard of Admin App\Admin who has access to the dashboard, but this is the error i get.
"Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: Argument 1 passed to Whitecube\NovaPage\NovaPagePolicy::viewAny() must be an instance of App\User, instance of App\Admin given, called in /Users/xxxxx/xxxxx/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php on line 614"
Any thoughts??
As introduced in #42 for the Page-Model, it would be very nice to also have the option to overwrite the PageResource and OptionResource class.
This would make this package much more customisable.
The title
, created_at
and updated_at
fields that automatically come with every template should be prefixed (for example __title
), so that it does not conflict or restrict the fields users can define.
It would be awesome to have a custom blade directive
Instead of:
<h1>{{ Page::get('title') }}</h1>
We could do something like
<h1>@page('title')</h1>
// or
<h1>@get('title')</h1>
We can debate on which keyword to use. I think @page
might be nice, but maybe we can find something else that works better.
In the docs you mentioned that the fields and cards definition is exactly the same as regular Laravel Nova Resources. In the laravel navo resource can add cards to the edit page. Like the image below
new Panel('Pagina informatie', $this->BaseAttributes()),
I can't figure out how this works with this package. Can you provide a code sample or edit the docs?
The Nova Pages tool doesn't load correctly when routes are cached with php artisan route:cache
.
Steps to reproduce:
php artisan route:cache
.php artisan route:clear
.From my debugging, appears as if the original Nova routes are used when caching is enabled which is giving a dependency injection error.
It would be good if there was a create page function so you can create new pages in the admin panel, and assign it to a specific template through a dropdown thats pull's through all the templates thats have been made.
When a new page is made it'll create a new blade templates that just have a @extend layout in there, and all the page fields will be added to the layout file. I currently have mine set in the layout file and then I use select fields to define which block I want to create so the client can go in and edit a page by selecting the component they want and in the order they want it to display.
Then we would set up a dynamic routes to auto assign the new created pages to a route without having to manual add the routes.
Registering templates without linking them to a specific Route would open the possibility to create "option forms" with cross-page static content, such as cookie banners, header & footer information, and so on.
How can authorize the viewing and editing of pages & options?
We're interested in completely disabling these features for specific users.
We tried registering a NovaPagePolicy and returning false in viewAny
and the rest, but it didn't do anything. Everyone could still see "Pages" and "options" in the menu, and could also edit them.
This is how we tried registering the policy in AuthServiceProvider::boot
:
Gate::policy(Manager::class, NovaPagePolicy::class);
Gate::policy(Template::class, NovaPagePolicy::class);
Is it not the way to go with authorization here?
When running the command php artisan make:template AboutUs
the package creates a template with the name About_us
this conflicts with the rest of the laravel code (uppercase words) MyControllerHere.php
Next when changed the template name to AboutUs
and creating a route like :
Route::get('/about-us', 'Home\AboutUsController@index')->middleware('loadNovaPage')
->template(\App\Nova\Templates\AboutUs::class)
->name('about.us');
Looks like the dot is removed ?
Don't know if i am missing something
When trying to insert an image in Trix field following error occurs:
Argument 1 passed to Whitecube\NovaPage\Pages\StaticResource::__construct() must be an instance of Whitecube\NovaPage\Pages\Template, instance of Whitecube\NovaPage\Pages\Manager given, called in /Users/michaellefrancois/www/www.trash2treasure.eu/vendor/laravel/nova/src/Http/Requests/InteractsWithResources.php on line 65 {"userId":4,"exception":"[object] (TypeError(code: 0): Argument 1 passed to Whitecube\\NovaPage\\Pages\\StaticResource::__construct() must be an instance of Whitecube\\NovaPage\\Pages\\Template, instance of Whitecube\\NovaPage\\Pages\\Manager given
Versions:
nova-page: 0.2.5
nova: 3.8.3
Not sure if intentional, maybe the doc should specify it but the values are cached when using the @get
directive which means one has to run a view:clear every time they update a page on nova.
<p>@get('phone')</p>
will be cached like this <p>+1234567890</p>
But <p>{{ Page::get('phone') }}</p>
will be <p><?php echo e(Page::get('Footer','phone')); ?></p>
Is that the intended behavior? If so maybe the docs could be updated to reflect that choice a bit more.
Symfony\Component\Debug\Exception\FatalThrowableError vendor\whitecube\nova-page\src\Pages\StaticResource.php line: 52 Argument 1 passed to Whitecube\NovaPage\Pages\StaticResource::__construct() must be an instance of Whitecube\NovaPage\Pages\Template, instance of Whitecube\NovaPage\Pages\Manager given, called in vendor\laravel\nova\src\Http\Requests\InteractsWithResources.php on line 65
`
public function fields(Request $request)
{
return [
FilemanagerField::make('Cover Image')
->help("max file size 4M")
->rules("required", new CheckImage(4))
->folder("pages")
->displayAsImage()
->hideFromIndex()
];
}
`
laravel version: 5.8.30
nova version: 2.0.9
nova-page version: 0.2.3
infinety-es/nova-filemanager version: 2.3
Not sure if issue or if this is the intended functionality, but once you update a page it doesn't redirect you to the details page as usual nova resources do.
But more importantly, if you update the page once, but then change some values and hit the update again you are greeted with
"Another user has updated this resource since this page was loaded. Please refresh the page and try again."
Using laravel 5.8.17 and latest nova 2.0.5.
Argument 2 passed to Spatie\NovaTranslatable\Translatable::Spatie\NovaTranslatable{closure}() must be an instance of Illuminate\Database\Eloquent\Model, instance of App\Nova\Templates\Home given
Using Spatie\NovaTranslatable.
After updating to Nova 2.0.1 I can't update pages anymore this function call aborts with a 404.
I'm currently digging to find a solution though I don't know Nova well enough and not having a commit history obviously doesn't help. This is what the changelog states for this version:
Security: prevent escaping the CSV parsing logic when validating unique values on resource update.
I will update the issue with my findings, I'm using Laravel 5.8.8
As requested in the closed PR #11, we should fix the Nova Page Resource in order to make it globally searchable.
When I try to update a resource I get the error Undefined method redirectAfterUpdate()
.
If I comment out the redirect line in Whitecube\NovaPage\Http\Controllers\ResourceUpdateController
everything works as expected
return response()->json([
'id' => $template->getKey(),
'resource' => $template->getAttributes(),
//'redirect' => $resource::redirectAfterUpdate($request, $request->newResourceWith($template)),
]);
This error is displayed when I try to save a page
Argument 1 passed to Whitecube\NovaPage\Pages\StaticResource::__construct() must be an instance of Whitecube\NovaPage\Pages\Template, instance of Whitecube\NovaPage\Pages\Manager given, called in E:\localhost\www\projects\shaparak\laravel8\nova\src\Http\Requests\InteractsWithResources.php on line 65
@extends('layout')
@section('pageName', 'some pageName')
@section('content')
<h1>Section Content</h1>
@endsection
local.ERROR: View [layout] not found.
I try @extends('nova::layout') but have the same error nova
layout not found
Here is my controller
public function show(Request $request, Manager $page, Template $template)
{
$page->loadForRoute($request->route());
return view('pages.about');
}
Great work with the package.
Currently the Nova tool label can be customised with config('novapage.label')
.
However, other strings in the tool are hard-coded and cannot be updated.
Most of these could be run through translations to allow this, such as changing Whitecube\NovaPage\Pages\Resource::singularLabel()
/**
* Get the displayable singular label of the resource.
*
* @return string
*/
public static function singularLabel()
{
return 'nova-page';
}
/**
* Get the displayable singular label of the resource.
*
* @return string
*/
public static function singularLabel()
{
return __('nova-page');
}
Hello, I'm trying to use Nova Tabs for a template.
But when I add the trait for see tabs on edit views (TabsOnEdit
trait), throws an error:
Cannot make non static method Whitecube\NovaPage\Pages\Template::fill() static
in class Eminiarts\Tabs\TabsOnEdit
Thank you.
We could have a path in the config file that specifies where the Templates should be located.
This would then be used by the make:template
command to store the file at the proper location.
This trait would be applied on the Template classes, and users would be able to provide an array called jsonAttributes
containing the keys of the json attributes that need to be automatically json decoded.
We are currently using this package, and in combination with nova-flexible-content this is a winner ๐
As nova-flexible-content now resolved the issue with advanced-nova-media-library field, it would be great to use this also with nova-page.
In the issue you state:
Spatie's MediaLibrary\HasMedia\HasMedia interface & MediaLibrary\HasMedia\HasMediaTrait should both be implemented on the resource model (not on the Flexible layout!) ;
Is there any idea how to get this working?
Would be nice to define the media collections in the template files and use advanced-nova-media-library field ๐ค
Easily create new template classes using a new artisan command and store the resulting file in App\Nova\Templates
.
From AppServiceProvider
$pages->registerOption('general', GeneralOptions::class);
don't works
$pages->register('option', 'general', GeneralOptions::class);
it works
We were a bit surprised to see what the Page::get()
does if the the content does not exist.
We had the issue that without content properly initialized the whole thing blew up, because Page::get()
threw an exception.
I think it would make more sense to make it more resilient and return null or a passed default value instead.
The same applies for loadForRoute()
as well. Also the documentation always mentions it as loadFromRoute()
- that function does not exist.
Hi, Brother your package is awesome.
But i am facing issue with filter, i have attached screenshot: http://prntscr.com/qf4tt3. It is not working properly please tell me how to hide it on index page.
Thank you.
When php artisan route:cache
ran, it's not working:
[2020-05-19 16:22:37] production.ERROR: Argument 1 passed to Whitecube\NovaPage\Pages\StaticResource::__construct() must be an instance of Whitecube\NovaPage\Pages\Template, instance of Whitecube\NovaPage\Pages\Manager given, called in /home/forge/foobar.nl/vendor/laravel/nova/src/Http/Requests/InteractsWithResources.php on line 65 {"userId":1,"exception":"[object] (TypeError(code: 0): Argument 1 passed to Whitecube\\NovaPage\\Pages\\StaticResource::__construct() must be an instance of Whitecube\\NovaPage\\Pages\\Template, instance of Whitecube\\NovaPage\\Pages\\Manager given, called in /home/forge/foobar.nl/vendor/laravel/nova/src/Http/Requests/InteractsWithResources.php on line 65 at /home/forge/foobar.nl/vendor/whitecube/nova-page/src/Pages/StaticResource.php:52)
[stacktrace]
@Nyratas
There is an option to automatically load middleware in Laravel Packages.
It works like this:
// In your package service provider
public function boot()
{
$router = $this->app['router'];
$router->pushMiddlewareToGroup('web', MyPackage\Middleware\WebOne::class);
}
Maybe we can load it by default, to make installation easier and quicker, which would be very nice.
We can then also make it possible to disable the middleware autoload with a boolean in the config file.
// config/novapage.php
[
'autoloadMiddleware' => true,
]
Hi!
I noticed a problem. Laravel 7.10, Nova 3.5.0.
NaN-NaN of -COUNT- in pagination line.
See here: https://prnt.sc/sf3n2b
when delete an image in nova page it generates an error getMorphClass BadMethodException
In the Documentation and on novapackages we can see Text Fields with the localization feature.
I saw you removed the ability to load templates with the locale parameter. What was the reason and what would be the best way to enable localization.
Making multiple Templates for every language?
Like the title says. in the NovaPagePolicy
the model App\User
is included. THis gives an error when the model is located somewhere else.
A good way would be like the User
resource where the user model is a config item.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.