Skip to content

Commit

Permalink
More page fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
agentphoenix committed Apr 23, 2024
1 parent efe0b8e commit 37481f7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 4 additions & 2 deletions nova/src/Pages/Actions/UpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
namespace Nova\Pages\Actions;

use Lorisleiva\Actions\Concerns\AsAction;
use Nova\Pages\Data\PageBlocksData;
use Nova\Pages\Data\PageData;
use Nova\Pages\Models\Page;

class UpdatePage
{
use AsAction;

public function handle(Page $page, array $data): Page
public function handle(Page $page, PageData|PageBlocksData $data): Page
{
return tap($page)->update($data);
return tap($page)->update($data->all());
}
}
15 changes: 15 additions & 0 deletions nova/src/Pages/Data/PageBlocksData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace Nova\Pages\Data;

use Spatie\LaravelData\Data;

class PageBlocksData extends Data
{
public function __construct(
public array $blocks
) {
}
}
3 changes: 2 additions & 1 deletion nova/src/Pages/Livewire/PageDesigner.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Nova\Foundation\Scribble\Profiles\PageBuilderProfile;
use Nova\Pages\Actions\PublishPage;
use Nova\Pages\Actions\UpdatePage;
use Nova\Pages\Data\PageBlocksData;
use Nova\Pages\Models\Page;

class PageDesigner extends FormComponent
Expand All @@ -37,7 +38,7 @@ public function form(Form $form): Form
#[On('saved-scribble-modal')]
public function save(): void
{
UpdatePage::run($this->page, $this->form->getState());
UpdatePage::run($this->page, PageBlocksData::from($this->form->getState()));

Notification::make()->success()
->title('Page design has been updated')
Expand Down

0 comments on commit 37481f7

Please sign in to comment.