Upgrade v2 to v3, cannot show record and cannot save without error outpput

I try follow documentation step by step upgrade from Filamet v2 to v3, already upgrade livewire 3 and filament 3, i check with composer show my system already using livewire 3 beta and filament 3.0.0. 1. i try using php artisan make:livewire-form Products/EditProduct --edit as sample and form showing but record not show for EditProduct 2. when i try submit nothing happen (can save to database), only in inspect show "Uncaught SyntaxError: unterminated comment livewire.js:8882:1" without any related error message. What supposed to do to fix that? I'm using form builder only without Panel Builder
<?php

namespace App\Livewire\ThemeCategory;

use App\Models\ThemeCategory;
use Filament\Forms;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Livewire\Component;
use Illuminate\Contracts\View\View;

class Edit extends Component implements HasForms
{
use InteractsWithForms;
public ThemeCategory $record;
public ?array $data = [];

public function mount(ThemeCategory $record): void
{
$this->record = $record;
$this->form->fill($record->toArray());
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name'),
Forms\Components\TextInput::make('meta'),
Forms\Components\TextInput::make('opsi'),
])
->statePath('data')
->model($this->record);
}

public function edit(): void
{
$data = $this->form->getState();

$this->record->update($data);
}

public function render(): View
{
return view('livewire.theme-category.edit');
}
}
<?php

namespace App\Livewire\ThemeCategory;

use App\Models\ThemeCategory;
use Filament\Forms;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Livewire\Component;
use Illuminate\Contracts\View\View;

class Edit extends Component implements HasForms
{
use InteractsWithForms;
public ThemeCategory $record;
public ?array $data = [];

public function mount(ThemeCategory $record): void
{
$this->record = $record;
$this->form->fill($record->toArray());
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name'),
Forms\Components\TextInput::make('meta'),
Forms\Components\TextInput::make('opsi'),
])
->statePath('data')
->model($this->record);
}

public function edit(): void
{
$data = $this->form->getState();

$this->record->update($data);
}

public function render(): View
{
return view('livewire.theme-category.edit');
}
}
<div>
<form wire:submit="edit">
{{ $this->form }}

<button type="submit">
Submit
</button>
</form>

<x-filament-actions::modals />
</div>
<div>
<form wire:submit="edit">
{{ $this->form }}

<button type="submit">
Submit
</button>
</form>

<x-filament-actions::modals />
</div>
1 Reply
uarefans
uarefansOP16mo ago
Solution Because need update app.js as instruction from livewire upgrade v3 Reference https://livewire.laravel.com/docs/upgrading#accessing-alpine-via-js-bundle
import {
Alpine,
Livewire,
} from "../../../vendor/livewire/livewire/dist/livewire.esm";

Alpine.plugin(customPlugin);

Livewire.start();
import {
Alpine,
Livewire,
} from "../../../vendor/livewire/livewire/dist/livewire.esm";

Alpine.plugin(customPlugin);

Livewire.start();
Want results from more Discord servers?
Add your server