Open stuartcusackie opened 1 year ago
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
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.
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.
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]); }
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);
}
}
I've recently upgraded to Nova4, along with upgrading all nova packages, including nova-page.
Now I have a problem where I cannot save the page template title. I have checked my migrations and config and they match the current versions. I have also checked that my template file structures match.
I only noticed this problem when I created a new template. My old page templates stayed the same so I did not notice there.
Everything else saves, just not the title. I tried downgrading but 0.3.2 didn't work at all.