GithubHelp home page GithubHelp logo

Comments (5)

metadeck avatar metadeck commented on June 16, 2024 1

I'm having the same issue. Upgraded this morning.

My error message is

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null (Connection: mysql, SQL: insert into `static_pages` (`name`, `title`, `type`, `attributes`, `created_at`, `updated_at`) values (pages.home, ?, route, {\"nova_page_title\":\"Home\",\"nova_page_created_at\":\"2023-08-15T16:02:09.000Z\",\"seo_description\":\"test\",\"header_text\":\"test\",\"header_description\":\"test\"}, 2023-08-15 15:03:25, 2023-08-15 15:03:25))

Checking through the source I can see that title is now nullable which is wasn't to begin with.

Schema::create('static_pages', function (Blueprint $table) {
            $table->increments('id');
            $table->string('type');
            $table->string('name');
            $table->string('title')->nullable();
            $table->json('attributes');
            $table->timestamps();
});

Looking at the request tab nova_page_title and nova_page_created_at are now stored in the attributes column.
Was there a migration guide between versions that I missed out on?

TIA

from nova-page.

jahvi avatar jahvi commented on June 16, 2024

Running into this issues as well, it looks like the title does get saved as an attribute just fine but it won't display in the admin or when using Page::title() or @get('title') in blade templates.

Even though the title gets saved as nova_page_title doing something like @get('nova_page_title') doesn't work either.

from nova-page.

brightlabscomau avatar brightlabscomau commented on June 16, 2024

Same issue here. The title attribute does not get populated on the index/edit/detail views within Nova also. Any chance on getting this fixed? I will need to either downgrade or fork this as we will soon be using this in production.

from nova-page.

brightlabscomau avatar brightlabscomau commented on June 16, 2024

If this helps anyone.. I resolved this (temporarily) by using an observer on the page model that updates the model with the title attribute.

if ($novaPageTitle = request('nova_page_title')) { $page->updateQuietly(['title' => $novaPageTitle]); }

from nova-page.

bingogg14 avatar bingogg14 commented on June 16, 2024

Workaround by overriding the Template and two methods

<?php

namespace App\Nova\NovaPages\Templates;

use Whitecube\NovaPage\Pages\Template as TemplateWhiteCube;

abstract class Template extends TemplateWhiteCube
{
    public function getTitle($default = null, $prepend = '', $append = ''): string
    {
        $this->title = $this->attributes['nova_page_title'];

        return parent::getTitle($default, $prepend, $append);
    }

    public function fill(array $data = []): void
    {
        if (empty($data['title'])) {
            $data['title'] = $data['attributes']['nova_page_title'];
        }

        parent::fill($data);
    }
}

from nova-page.

Related Issues (20)

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.