Coder Social home page Coder Social logo

nova-page-manager's Introduction

Nova Page Manager

Latest Version on Packagist Total Downloads

This Laravel Nova package allows you to create and manage pages and regions for your frontend application.

Requirements

- PHP >=8.0
- laravel/nova ^4.13

Features

  • Page and region management w/ custom fields
  • Multiple locale support

Screenshots

Form (dark)

Installation

Install the package in a Laravel Nova project via Composer and run migrations:

# Install package
composer require outl1ne/nova-page-manager

# Run automatically loaded migrations
php artisan migrate

Publish the nova-page-manager configuration file and edit it to your preference:

php artisan vendor:publish --provider="Outl1ne\PageManager\NPMServiceProvider" --tag="config"

Register the tool with Nova in the tools() method of the NovaServiceProvider:

// in app/Providers/NovaServiceProvider.php

public function tools()
{
    return [
        // ...
        new \Outl1ne\PageManager\PageManager()
          ->withSeoFields(fn () => []), // Optional
    ];
}

Usage

Creating templates

Templates can be created using the following Artisan command:

php artisan npm:template {className}

This will ask you a few additional details and will create a base template in App\Nova\Templates.

The base template exposes a few overrideable functions:

// Name displayed in CMS
public function name(Request $request)
{
    return parent::name($request);
}

// Fields displayed in CMS
public function fields(Request $request): array
{
    return [];
}

// Resolve data for serialization
public function resolve($page): array
{
    // Modify data as you please (ie turn ID-s into models)
    return $page->data;
}

// Page only
// Optional suffix to the route (ie {blogPostName})
public function pathSuffix() {
    return null;
}

Registering templates

All your templates have to be registered in the config/nova-page-manager.php file.

// in /config/nova-page-manager.php

// ...
'templates' => [
    'pages' => [
        'home-page' => [
            'class' => '\App\Nova\Templates\HomePageTemplate',
            'unique' => true, // Whether more than one page can be created with this template
        ],
    ],
    'regions' => [
        'header' => [
            'class' => '\App\Nova\Templates\HeaderRegionTemplate',
            'unique' => true,
        ],
    ],
],
// ...

Defining locales

The locales are defined in the config file.

// in /config/nova-page-manager.php

// ...
'locales' => [
  'en' => 'English',
  'et' => 'Estonian',
],

// OR

'locales' => function () {
  return Locale::all()->pluck('name', 'key');
},

// or if you wish to cache the configuration, pass a function name instead:

'locales' => NPMConfiguration::class . '::locales',
// ...

Add links to front-end pages

To display a link to the actual page next to the slug, add or overwrite the closure in config/nova-page-manager.php for the key base_url.

// in /config/nova-page-manager.php

'base_url' => 'https://webshop.com', // Will add slugs to the end to make the URLs

// OR

'base_url' => function ($page) {
  return env('FRONTEND_URL') . '/' . $page->path;
},

Overwriting models and resources

You can overwrite the page/region models or resources, just set the new classes in the config file.

Advanced usage

Non-translatable panels

There's some cases where it's more sensible to translate sub-fields of a panel instead of the whole panel. This is possible, but is considered an "advanced usecase" as the feature is really new and experimental, also the developer experience of it is questionable.

You can create a non-translatable panel like so:

// In your PageTemplate class

public function fields() {
  return [
    Panel::make('Some panel', [
      Text::make('Somethingsomething'),
      Text::make('Sub-translatable', 'subtranslatable')
        ->translatable(),
    ])
    ->translatable(false),
  ];
}

This will create a key with __ in the page data object. This means that the page data will end up looking something like this:

[
  '__' => [
    'somethingsomething' => 'your value',
    'subtranslatable' => [
      'en' => 'eng value',
      'et' => 'et value'
    ]
  ],
  'en' => [],
  'et' => [],
]

Helper functions

Helper functions can be found in the Outl1ne\PageManager\Helpers\NPMHelpers class.

NPMHelpers::getPagesStructure()

Calls resolve() on their template class and returns all pages as a tree where child pages are nested inside the children array key recursively.

NPMHelpers::getPages()

Calls resolve() on their template class and returns all pages. Returns an array of arrays.

NPMHelpers::getRegions()

Calls resolve() on their template class and returns all regions. Returns an array of arrays.

NPMHelpers::getPageByTemplate($templateSlug)

Finds a single page by its template slug (from the config file), calls resolve() on its template class and returns it.

NPMHelpers::getPagesByTemplate($templateSlug)

Same as getPageByTemplate, but returns an array of pages.

NPMHelpers::formatPage($page)

Calls resolve() on the page's template class and returns the page as an array.

NPMHelpers::formatRegion($region)

Calls resolve() on the region's template class and returns the region as an array.

Localization

The translation file(s) can be published by using the following command:

php artisan vendor:publish --provider="Outl1ne\PageManager\ToolServiceProvider" --tag="translations"

You can add your translations to resources/lang/vendor/nova-page-manager/ by creating a new translations file with the locale name (ie et.json) and copying the JSON from the existing en.json.

Credits

License

Nova page manager is open-sourced software licensed under the MIT license.

nova-page-manager's People

Contributors

akiyamasm avatar allantatter avatar dependabot[bot] avatar ferdiunal avatar jgile avatar kaareloun avatar kakajansh avatar kasparrosin avatar kikoseijo avatar liorocks avatar lvdhoorn avatar marcelosantos89 avatar marttinnotta avatar mikkoun avatar murad-optimist avatar ribesalexandre avatar shahruslan avatar sloveniangooner avatar stephenlake avatar tarpsvo avatar trippo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nova-page-manager's Issues

multilingual pages and parent/child relations

Hi,

I'm facing an issue with multilingual pages and parent/child relations. I'm using two languages: French and English.
Let's say I create a page with the slug french-parent and then its translation with the slug english-parent.

Then I a create a french-child page whose parent is french-parent and an english-child page as a translation of french-child. english-child's page path is english-parent/english-child and its locale_parent_id is the id of french-child.
So far so good. However the parent_id of this english-child page is null.

Is this normal? How can I access the parent page of a translated child page?
Thanks

[bug] N+1 Query Issue(s) in Nova Index view

Hi,

With 97 records, and some nesting, displaying pages results in an N+1 query issue.

page_manager_n1_issue

I have traced this back to the Page::getPathAttribute() implementation. It's not optimized for loading via Nova, and doesn't cache any of the intermediary models. We should be able to mostly solve this with an eager load on the Nova view, but adding a $with = ['parent'] property to the Nova definition didn't do anything for me. So at this point, I'm concerned that it's in the logic itself.

How to hide Regions?

I want to hide the Regions and keep only the Pages. What's the best way to do this? Thank you

Localization and Drafts don't play well together

Drafts on secondary locales are lost on every edit, unless the user knows exactly how to handle the problem.

Here's the scenario:

  • have 2 locales, let's say en and es
  • create a new page in en
  • from the index page, create a child page in es using the + es button on listing, and publish it
  • return to index, press ✏️ es then save the updated page as draft (with create draft button)

At this point the draft page is not accessible in normal navigation -- repeating previous step will open original page, and an attempt to create another draft will result in a DB error.
The only workaround to find the draft is to filter index by es locale then edit/publish/discard

Can't access page on frontend

Hello,

I'm trying to test Your package and i can't access to www.some_domain.com/page-path it gives me an 404 error.

Do i need to add anything to laravel routes ?
my page_url: (i needed to remove extra "/" becouse somehow it shows doubled "//" when i click "View" next to slug.
nova-page-manager.php

use OptimistDigital\NovaPageManager\Models\Page;
//
'page_url' => function (Page $page) {
           return env('FRONTEND_URL') . $page->path;
         }, 

I don't see also in readme adding a extra line to .env or it should be replaced to default env('APP_URL')
FRONTEND_URL=www.some_domain.com

Launched on:
Laravel Framework 8.52.0
Nova 3.27

Old existing working page `data` isn't parsed correctly in v4.0.4; works fine with v4.0.2

Composer update bumped this package from 4.0.2 → 4.0.4. This broke my pages. The existing, not changed data wasn't correctly mapped anymore. I reverted back to 4.0.2 and everything works as expected.

It threw me off given that I did not expect a small version bump to break things ;-)

I did not fully debug this, it was easier to revert. but it seems to be in nova_resolve_fields_data function and line 303-ish

((isset($value->component)) && ($value->component === 'panel') && (nova_page_manager_sanitize_panel_name($value->name) === $fieldAttribute))

that last comparison is failing. The keys are however the same at first glance, but like I said I did not dig in deep.
v4.0.2 works perfectly.

Nova hangs when creating a locale of a page

When creating a locale of a page - Nova admin hangs. Normal create works, no problems.

Tried to find the issue, but can't isolate where it happens.

The resource gets saved in the database - though, but after that, nothing is happening and screen freezes.

Error migration 2019_06_10_000004_add_draft_fields_to_page

Migration 2019_06_10_000004_add_draft_fields_to_page. When I roll back, I get this error. This is because you first delete the column published and then you delete the index. After deleting a column, the index is also deleted automatically. Therefore, I propose to do the following order of commands:

$table->dropForeign($pagesTableName . '_draft_parent_id_foreign');
$table->dropUnique('nova_page_manager_locale_slug_published_unique');
$table->unique(['locale', 'slug'], 'nova_page_manager_locale_slug_unique');

$table->index('locale_parent_id', 'nova_page_manager_locale_parent_id_workaround_index');
$table->dropUnique('nova_page_manager_locale_parent_id_locale_published_unique');
$table->unique(['locale_parent_id', 'locale'], 'nova_page_manager_locale_parent_id_locale_unique');
$table->dropIndex('nova_page_manager_locale_parent_id_workaround_index');

$table->dropColumn('draft_parent_id');
$table->dropColumn('published');
$table->dropColumn('preview_token');

For myself, I fixed these mistakes, but others may have problems.

Ability to use attachments with Trix fields

Ideally regions and pages should support the standard Trix field attachments (https://nova.laravel.com/docs/1.0/resources/fields.html#file-uploads)

These can also be used by other WYSIWYG components as well (eg https://novapackages.com/packages/froala/nova-froala-field)

Trix::make('description')
  ->withFiles('public'),

Currently this seems to fail, triggering an abort in Laravel\Nova\Http\Controllers\TrixAttachmentController I think it's because the Trix field components don't expect the underlying database field to be cast to json rather than holding text and so the attribute that holds the image can't be located.

Issue in Region.php (Panel Feature) with trailing comma at #41

I think one of the latest updates in the Region.php is breaking in pre-PHP 7.3

On line 41 of Region.php, there is a trailing "," comma that causes the error.

Similar code is in Page.php without the breaking "'" comma.

Just noticed when doing a test deploy.

image

Issue with HEREDOC syntax on Page.php (PHP 7.2.24)

I installed this package following the instructions, but when I go to Nova admin panel, I get the following error:

Facade\Ignition\Exceptions\ViewException
syntax error, unexpected ']', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) (View: /var/www/nova/resources/views/layout.blade.php)

Which can be tracked to this file:

vendor/optimistdigital/nova-page-manager/src/Nova/Page.php

On this file, I found the offending lines (60-69) using HEREDOC syntax:

if (empty($pageBaseUrl)) return <<<HTML
                    <span class="bg-40 text-sm py-1 px-2 rounded-lg whitespace-no-wrap">$pagePath</span>
                HTML;

                return <<<HTML
                    <div class="whitespace-no-wrap">
                        <span class="bg-40 text-sm py-1 px-2 rounded-lg">$pagePath</span>
                        <a target="_blank" href="$pageUrl" class="text-sm py-1 px-2 text-primary no-underline dim font-bold">$buttonText</a>
                    </div>
                HTML;

Found that when using HEREDOC syntax, in this case, the ending HTML on both statements must be on first character of the line, at least up to PHP 7.2 (https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc)
Changing those lines to this:

if (empty($pageBaseUrl)) return <<<HTML
                    <span class="bg-40 text-sm py-1 px-2 rounded-lg whitespace-no-wrap">$pagePath</span>
HTML;

                return <<<HTML
                    <div class="whitespace-no-wrap">
                        <span class="bg-40 text-sm py-1 px-2 rounded-lg">$pagePath</span>
                        <a target="_blank" href="$pageUrl" class="text-sm py-1 px-2 text-primary no-underline dim font-bold">$buttonText</a>
                    </div>
HTML;

Seems to fix the problem.
I guess that in PHP 7.3, this issue probably doesn't happen, but this package should be compatible with current Laravel minimum PHP version (PHP >= 7.2.0)

Could anyone please confirm? I'd do the PR by myself if its confirmed.

Cannot unpack array with string keys

I am getting this error on latest pre release.
Templates config looks like this
'templates' => [
'pages' => [
'language-page' => [
'class' => \App\Nova\Templates\LanguagePage::class,
'unique' => false, // Whether more than one page can be created with this template
],
],
'regions' => [
// 'header' => [
// 'class' => '\App\Nova\Templates\HeaderRegionTemplate',
// 'unique' => true,
// ],
],
],

Using Spatie's Laravel Translatable

Hi, have you had any thoughts on implementing Spatie's package to manage the translations? It would make for less entries in the database.

Disable the package without composer remove

Hi,

is there any other way to disable this package without doing composer remove?
I have written a customized model and resources for pages,
with this package installed, it will points to /resources/pages, then my customized model and resources are overridden

I couldn't do composer remove as my old migration has used this package.

How to add auth policy for Page model of this package?

I've tried adding it to the policies array on AuthServiceProvider but Nova isn't picking it up, I assume because of how the package is setup in Nova.

I'm calling the policy in the array like this:

protected $policies = [
        'OptimistDigital\NovaPageManager\Models\Page' => 'App\Policies\SuperAdminPolicy'
    ];

Any thoughts on how I might be able to set one up to secure this section from certain roles?

Can't change the page template afterwards

Hi there, maybe I am missing something but I can't change the page template on editing a page (actually I have 2 templates). When I newly create a page, I can choose the page template.

Bildschirmfoto 2021-09-15 um 14 32 10

Bildschirmfoto 2021-09-15 um 14 31 08

Drafts

When you unpublish a page it does not set the preview_token again.
Maybe this should be added?

Error creating a region in the postgres database

While creating a region, I get an error:

SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type bigint: "{{resourceId}}" (SQL: select count(*) as aggregate from "nova_page_manager_regions" where "template" = footer-region and "id" <> {{resourceId}} and "locale" = en)

In Mysql(and mariadb), this sql is executed normally, but in the postgres it does not allow it to be executed due to the fact that "{{resourceId}}" string does not correspond to the bigInt type.

Call to a member function pathSuffix() on null on Nova 4

Attempting to upgrade my Nova 3 to Nova 4.10.1, getting this error when I try to look at the Pages resource page on Nova.

Putting this here for posterity because you need to create a new template in order for this to work, the Nova 3 templates won't work.

{
    "message": "Call to a member function pathSuffix() on null",
    "exception": "Error",
    "file": "/Users/tomfilepp/work/ResultGroup/vendor/outl1ne/nova-page-manager/src/Nova/Resources/Page.php",
    "line": 142,
    "trace": [
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/outl1ne/nova-page-manager/src/Nova/Resources/Page.php",
            "line": 66,
            "function": "getPathPrefixAndSuffix",
            "class": "Outl1ne\\PageManager\\Nova\\Resources\\Page",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/ResolvesFields.php",
            "line": 610,
            "function": "fields",
            "class": "Outl1ne\\PageManager\\Nova\\Resources\\Page",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/ResolvesFields.php",
            "line": 33,
            "function": "availableFields",
            "class": "Laravel\\Nova\\Resource",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Resource.php",
            "line": 455,
            "function": "indexFields",
            "class": "Laravel\\Nova\\Resource",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Collections/HigherOrderCollectionProxy.php",
            "line": 60,
            "function": "serializeForIndex",
            "class": "Laravel\\Nova\\Resource",
            "type": "->"
        },
        {
            "function": "Illuminate\\Support\\{closure}",
            "class": "Illuminate\\Support\\HigherOrderCollectionProxy",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Collections/Arr.php",
            "line": 560,
            "function": "array_map"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Collections/Collection.php",
            "line": 723,
            "function": "map",
            "class": "Illuminate\\Support\\Arr",
            "type": "::"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Collections/HigherOrderCollectionProxy.php",
            "line": 61,
            "function": "map",
            "class": "Illuminate\\Support\\Collection",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Http/Resources/IndexViewResource.php",
            "line": 23,
            "function": "__call",
            "class": "Illuminate\\Support\\HigherOrderCollectionProxy",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Http/Resources/Resource.php",
            "line": 41,
            "function": "toArray",
            "class": "Laravel\\Nova\\Http\\Resources\\IndexViewResource",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Http/Controllers/ResourceIndexController.php",
            "line": 19,
            "function": "toResponse",
            "class": "Laravel\\Nova\\Http\\Resources\\Resource",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
            "line": 54,
            "function": "__invoke",
            "class": "Laravel\\Nova\\Http\\Controllers\\ResourceIndexController",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
            "line": 45,
            "function": "callAction",
            "class": "Illuminate\\Routing\\Controller",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 261,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\ControllerDispatcher",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 204,
            "function": "runController",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 725,
            "function": "run",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 141,
            "function": "Illuminate\\Routing\\{closure}",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Http/Middleware/Authorize.php",
            "line": 18,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\Authorize",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/whitecube/nova-flexible-content/src/Http/Middleware/InterceptFlexibleAttributes.php",
            "line": 27,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Whitecube\\NovaFlexibleContent\\Http\\Middleware\\InterceptFlexibleAttributes",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Http/Middleware/BootTools.php",
            "line": 20,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\BootTools",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Http/Middleware/DispatchServingNovaEvent.php",
            "line": 24,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\DispatchServingNovaEvent",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/inertiajs/inertia-laravel/src/Middleware.php",
            "line": 88,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Inertia\\Middleware",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
            "line": 50,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php",
            "line": 44,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Http/Middleware/Authenticate.php",
            "line": 31,
            "function": "handle",
            "class": "Illuminate\\Auth\\Middleware\\Authenticate",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\Authenticate",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php",
            "line": 78,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",
            "line": 49,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
            "line": 121,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
            "line": 64,
            "function": "handleStatefulRequest",
            "class": "Illuminate\\Session\\Middleware\\StartSession",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Session\\Middleware\\StartSession",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",
            "line": 37,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",
            "line": 67,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 116,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 726,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 703,
            "function": "runRouteWithinStack",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 667,
            "function": "runRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 656,
            "function": "dispatchToRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 167,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 141,
            "function": "Illuminate\\Foundation\\Http\\{closure}",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/nova/src/Http/Middleware/ServeNova.php",
            "line": 23,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\ServeNova",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php",
            "line": 31,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php",
            "line": 40,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TrimStrings",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
            "line": 86,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php",
            "line": 49,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Http\\Middleware\\HandleCors",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php",
            "line": 39,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 180,
            "function": "handle",
            "class": "Illuminate\\Http\\Middleware\\TrustProxies",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 116,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 142,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 111,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/work/ResultGroup/public/index.php",
            "line": 52,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/tomfilepp/.composer/vendor/laravel/valet/server.php",
            "line": 234,
            "function": "require"
        }
    ]
}

config:cache

we have problem with config:cache / optimize and closures in config...

In ConfigCacheCommand.php line 71:
Your configuration files are not serializable.  

here has some info for this problem: laravel/framework#9625

example from config:

 'locales' => function () {
        return ['ex', 'am', 'ple'];
 },
'page_url' => function (Page $page) {
       return env('FRONTEND_URL') . '/' . $page->path;
},

Tips : Nova >= 2.0.7

I've found solution for Nova > 2.0.7

There is a bug introduced by Nova with panels. Will be fixed in next release (I've seen the commit).

Solution :

You have to update nova/src/Http/Controllers/UpdateFieldController.php

With :

public function index(NovaRequest $request)
{
    $resource = $request->newResourceWith($request->findModelOrFail());
    $resource->authorizeToUpdate($request);

    return response()->json([
            'fields' => $resource->updateFieldsWithinPanels($request),
            'panels' => $resource->availablePanelsForUpdate($request),
        ]);
}

Best regards.

Slug field

It would be good if the package could fill in the slug field based on what is entered in the title box, or a way to disable it completely so that we can add our own implementation.

Great package though.

Duplicate pages, especially for translations

Hello,

Thank you very much for this package (and all the others) that help me build a headless CMS.

For the construction of my pages, I often use "flexible content".

When I have a page in English and I want to translate it into another language, my structure is not taken over. Same for some non-translatable fields (ex: images).

Is there a way with your package to "duplicate" the current content when creating a new translation? In such a way that my structure would remain the same and the images would not have to be added again.

Thanks for your help

Doesn't work as expected with Nova TinyMCE

Hello,

I tried to integrate the NovaTinyMCE package with the nova-page-manager.

When I integrate it normally, it does not work (the javascript of the package does not seem to be executed)

Capture d’écran 2021-03-31 à 16 47 48

When I integrate NovaTinyMCE in the default fields (in vendors: vendor/optimistdigital/nova-page-manager/src/Nova/Page.php) it works.

Capture d’écran 2021-03-31 à 16 49 59

How is it possible ?

Thank you

Configuration caching error

If in the nova-page-manager.php file, in the seo_fields key, specify an array of fields of the Text type:

    'seo_fields' => [
        Text::make('SEO Title', 'title_seo'),
        Textarea::make('SEO Description', 'description_seo'),
        Text::make('SEO Keywords', 'keywords_seo'),
    ],

when caching the configuration(php artisan optimize), we get an error:
Method Laravel\\Nova\\Fields\\Text :: __ set_state does not exist.
The Callable array is working fine.

LogicException: Your configuration files are not serializable.

PHP 7.3, Laravel 6.x, Nova 2.7

php artisan optimize

fails with:

LogicException: Your configuration files are not serializable.

due to:
config/nova-page-manager.php

  /*
    |--------------------------------------------------------------------------
    | Page URL
    |--------------------------------------------------------------------------
    |
    | If a closure is specified, a link to the page is shown next to
    | the page slug. The closure accepts a Page model as a paramater.
    |
    | Set to `null` if the link should not be displayed.
    |
    */

    'page_url' => function (Page $page) {
        // For example:
        // return env('FRONTEND_URL') . $page->path;
        return null;
    }

Returning null instead of a closure allows optimize to complete as expected.

BelongsToMany Relationship Not Working on Page Template

Like the title says, when I define the following Page template, the relationship is all kinds of broken:

<?php

namespace App\Nova\Templates;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\BelongsToMany;
use OptimistDigital\NovaPageManager\Template;

class DocumentsPageTemplate extends Template
{
    public static $type = 'page';
    public static $name = 'carousel';
    public static $seo = false;
    public static $view = null;

    public function fields(Request $request): array
    {
        return [
            BelongsToMany::make('Documents')
        ];
    }
}

It looks like there are problem from two areas: first, the field isn't listed on some of the nova-api calls. Deeper in, the field attribute ends up prefixed with data->, breaking more Nova stuff. I did a LOT of hackery to get this working on my setup, but I am curious if maybe I'm just doing something wrong or if this is a known-issue?

How to use region?

I don't know exactly how to use the region, page is easily to be understood, but region... I don't find any relation to the page resource, pls give me some suggestion, thanks.

Postgres database migration error

I am using postgres database and I get this error when migrating (2019_11_29_000005_make_slug_locale_published_parent_id_pair_unique.php):

  SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near "FROM"
LINE 2:             FROM nova_page_manager_pages
                    ^ (SQL: SHOW KEYS
            FROM nova_page_manager_pages
            WHERE Key_name LIKE 'nova_page_manager_pages%'
            AND Key_name LIKE '%locale_slug_published_unique')

This migration is for MySQL only?

And can I skip this migration if my initial nova_page_manager_pages table is empty?

Can't use nova-tabs with nova-page-manager

Hello,

First of all, thank you for this great package.

I am trying to implement the popular nova-tabs package with nova-page-manager.

I've extended the "Page" resource of this package to add the "useOnEditTabs" trait to have the tabs in the page-manager edit view.

It works except that... every time I change "tabs", it refreshes the page.

Something with this package is doing this behavior, can you tell me what?

Thank you

Trying to access array offset on value of type null

Hey there, great package!

I've been experimenting with the package and found that using nova_page_manager_get_page_by_path with a draft page throws the following when not providing a preview token (so basically a regular user):

[2021-04-30 09:42:08] local.ERROR: Trying to access array offset on value of type null
{"userId":1,"exception":"
[object] (ErrorException(code: 0): Trying to access array offset on value of type null at D:\\Projects\\[SNIP]\\vendor\\optimistdigital\\nova-page-manager\\src\\helpers.php:368)
[stacktrace]
#0 D:\\Projects\\[SNIP]\\vendor\\optimistdigital\\nova-page-manager\\src\\helpers.php(368): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 D:\\Projects\\[SNIP]\\app\\Http\\Controllers\\PageController.php(41): nova_page_manager_get_page_by_path()
[SNIP]
"} 

The page controller looks like the following:

public function show(string $path)
{
    $previewToken = request()->input('preview');
    $result = nova_page_manager_get_page_by_path($path, $previewToken, 'nl');

    // Snip for brevity, validates the existence of $result in addition to other things.

    // Return the view using data from $result.
    return View::first(["pages.{$result->template}", 'pages.fallback'], $data);
}

This seems to occur because $parent cannot be properly found in the nova_page_manager_get_page_by_path helper function. Please feel free to reach out if you need more information!

Instead of it crashing like this, I would expect it to abort with 404 if the page could not be found at all (for regular users so without preview tokens, a draft should not be found at all). Is there some logic beforehand I should be manually checking for? If so, please let me know and update the documentation as I could not find information regarding this specific case. Thanks!

Here's my composer json so you know what versions I'm using. As far as I'm aware, it's the latest versions:

"optimistdigital/nova-drafts": "^1.1",
"optimistdigital/nova-page-manager": "^3.5",

Cheers!

Database error after moving from mysql to psql

Hello, after changing database saving pages doesn't work for me, i get that error:
"SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type boolean: "{{published}}" (SQL: select count(*) as aggregate from "nova_page_manager_pages" where "slug" = / and "id" <> 1 and "published" = {{published}} and "locale" = en and "parent_id" is null)"
How can I fix it?

Rolling back error

Hello, after php artisan migrate:refresh I get this error:

Rolling back: 2019_11_29_000005_make_slug_locale_published_parent_id_pair_unique

Illuminate\Database\QueryException

SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'nova_page_manager_locale_slug_published_unique' (SQL: alter table nova_page_manager_pages add unique nov a_page_manager_locale_slug_published_unique(locale, slug, published))

stacktrace

[2021-01-11 13:30:11] local.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'nova_page_manager_locale_slug_published_unique' (SQL: alter table `nova_page_manager_pages` add unique `nova_page_manager_locale_slug_published_unique`(`locale`, `slug`, `published`)) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'nova_page_manager_locale_slug_published_unique' (SQL: alter table `nova_page_manager_pages` add unique `nova_page_manager_locale_slug_published_unique`(`locale`, `slug`, `published`)) at C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:678)
[stacktrace]
#0 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(638): Illuminate\\Database\\Connection->runQueryCallback('alter table `no...', Array, Object(Closure))
#1 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(472): Illuminate\\Database\\Connection->run('alter table `no...', Array, Object(Closure))
#2 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Schema\\Blueprint.php(102): Illuminate\\Database\\Connection->statement('alter table `no...')
#3 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Schema\\Builder.php(337): Illuminate\\Database\\Schema\\Blueprint->build(Object(Illuminate\\Database\\MySqlConnection), Object(Illuminate\\Database\\Schema\\Grammars\\MySqlGrammar))
#4 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Schema\\Builder.php(184): Illuminate\\Database\\Schema\\Builder->build(Object(Illuminate\\Database\\Schema\\Blueprint))
#5 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(261): Illuminate\\Database\\Schema\\Builder->table('nova_page_manag...', Object(Closure))
#6 C:\\laragon\\www\\atparts\\vendor\\optimistdigital\
ova-page-manager\\database\\migrations\\2019_11_29_000005_make_slug_locale_published_parent_id_pair_unique.php(46): Illuminate\\Support\\Facades\\Facade::__callStatic('table', Array)
#7 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php(392): MakeSlugLocalePublishedParentidPairUnique->down()
#8 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php(401): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}()
#9 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php(363): Illuminate\\Database\\Migrations\\Migrator->runMigration(Object(MakeSlugLocalePublishedParentidPairUnique), 'down')
#10 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php(284): Illuminate\\Database\\Migrations\\Migrator->runDown('C:\\\\laragon\\\\www\\\\...', Object(stdClass), false)
#11 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php(334): Illuminate\\Database\\Migrations\\Migrator->rollbackMigrations(Array, Array, Array)
#12 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php(313): Illuminate\\Database\\Migrations\\Migrator->resetMigrations(Array, Array, false)
#13 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Console\\Migrations\\ResetCommand.php(67): Illuminate\\Database\\Migrations\\Migrator->reset(Array, false)
#14 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php(541): Illuminate\\Database\\Console\\Migrations\\ResetCommand->Illuminate\\Database\\Console\\Migrations\\{closure}()
#15 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Console\\Migrations\\ResetCommand.php(69): Illuminate\\Database\\Migrations\\Migrator->usingConnection(NULL, Object(Closure))
#16 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): Illuminate\\Database\\Console\\Migrations\\ResetCommand->handle()
#17 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#18 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#19 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#20 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(610): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#21 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(136): Illuminate\\Container\\Container->call(Array)
#22 C:\\laragon\\www\\atparts\\vendor\\symfony\\console\\Command\\Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArrayInput), Object(Illuminate\\Console\\OutputStyle))
#23 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(121): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArrayInput), Object(Illuminate\\Console\\OutputStyle))
#24 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Concerns\\CallsCommands.php(68): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArrayInput), Object(Illuminate\\Console\\OutputStyle))
#25 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Concerns\\CallsCommands.php(28): Illuminate\\Console\\Command->runCommand('migrate:reset', Array, Object(Illuminate\\Console\\OutputStyle))
#26 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Console\\Migrations\\RefreshCommand.php(110): Illuminate\\Console\\Command->call('migrate:reset', Array)
#27 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Console\\Migrations\\RefreshCommand.php(55): Illuminate\\Database\\Console\\Migrations\\RefreshCommand->runReset(NULL, Array)
#28 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): Illuminate\\Database\\Console\\Migrations\\RefreshCommand->handle()
#29 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#30 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#31 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#32 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(610): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#33 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(136): Illuminate\\Container\\Container->call(Array)
#34 C:\\laragon\\www\\atparts\\vendor\\symfony\\console\\Command\\Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#35 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(121): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#36 C:\\laragon\\www\\atparts\\vendor\\symfony\\console\\Application.php(971): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#37 C:\\laragon\\www\\atparts\\vendor\\symfony\\console\\Application.php(290): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Database\\Console\\Migrations\\RefreshCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#38 C:\\laragon\\www\\atparts\\vendor\\symfony\\console\\Application.php(166): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#39 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Application.php(93): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#40 C:\\laragon\\www\\atparts\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(129): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#41 C:\\laragon\\www\\atparts\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#42 {main}

Cant use helper functions in Nova

Im trying to use the nova_get_regions() helper function within Nova itself, so I can pull in some region data and display it in a Field

For some reason this causes some kind of infinite loop, hang or crash? The page just times out. Is there a way I can access region or page data within Nova without this happening?

[Feature Request] Merge navigation into one button

Hey there, OptimistDigital!

I thought I'd write in to request a feature from you guys! Currently, if you have regions or pages disabled, the navigation layout still uses a UL element to show the resources in the tool. It'd be a great addition for clarity sake to move the regions or pages link to the button itself.

Here's what I mean:
image

Which would turn into:
image

What would be even greater is an option to just override the navigation view itself. I've been looking around a little but I was unable to come up with a functioning result. If there is a way to do this currently, it would be greatly appreciated if you could point me to said solution!

As an alternative, it would also be great if the resources could be moved to the Nova default "Resources" section, disabling the navigation view entirely. While this is not preferred for my use case, I feel like it could be another great addition. Thank you!

Have a good one!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.