Multiple pages

Hello. I am using multiple pages to create a listing. First, I have a "Getting started" page. After I complete the fields and press the next button, the listing is created and it redirects me to the next page called "Listing details". But my problem is that if I am on the listing details page and press back to "getting started" page, the data are not filled and if I press again the next button it creates another listing. How can I solve this problem? Thank you in advance!
public $property_type = '';
public $listing_type = '';
public $property_category = '';

public $listing;


public function mount(Listing $listing): void
{
$this->listing = $listing;

$this->form->fill();
}
public function save()
{
Listing::create($this->form->getState());
return redirect('/admin/listings/create/property-listed');
$this->form->fill();
}
public $property_type = '';
public $listing_type = '';
public $property_category = '';

public $listing;


public function mount(Listing $listing): void
{
$this->listing = $listing;

$this->form->fill();
}
public function save()
{
Listing::create($this->form->getState());
return redirect('/admin/listings/create/property-listed');
$this->form->fill();
}
This is my "getting started" page. It also has a schema.
<x-filament::page>
<form wire:submit.prevent="save" class="space-y-8">
{{ $this->form }}
<div style="display:flex; justify-content:space-between;">
<div></div>
<x-filament::button
outlined
color="success"
type="submit"
form="save"
iconPosition="after"
icon="heroicon-o-arrow-right">
Next
</x-filament::button>
</div>
</form>
</x-filament::page>
<x-filament::page>
<form wire:submit.prevent="save" class="space-y-8">
{{ $this->form }}
<div style="display:flex; justify-content:space-between;">
<div></div>
<x-filament::button
outlined
color="success"
type="submit"
form="save"
iconPosition="after"
icon="heroicon-o-arrow-right">
Next
</x-filament::button>
</div>
</form>
</x-filament::page>
This is my blade for the first page
public function back()
{
return redirect('/admin/listings/create/getting-started');
}
public function save()
{
return redirect('/admin/listings/create/address-details');
}
protected function getFormSchema(): array
{
return [
Shout::make('ComingSoon')
->content('Coming Soon. Press "Next" to proceed to the next step.')
->columnSpan('full')
];
}
public function back()
{
return redirect('/admin/listings/create/getting-started');
}
public function save()
{
return redirect('/admin/listings/create/address-details');
}
protected function getFormSchema(): array
{
return [
Shout::make('ComingSoon')
->content('Coming Soon. Press "Next" to proceed to the next step.')
->columnSpan('full')
];
}
This is my second page
0 Replies
No replies yetBe the first to reply to this messageJoin