Custom page with record update

I've added a custom page to my app the page name is 'resources/views/filament/pages/ confirm-quote.blade.php the content is the same of welcome.blade.php + i've added @livewire('confirm-quote') and @livewire('notifications') then i have created a livewire component app/livewire/ConfirmQuote.php

<?php

namespace App\Livewire;

use App\Models\Repair;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Illuminate\Contracts\View\View;
use Livewire\Component;
use Filament\Notifications\Notification;

class ConfirmQuote extends Component implements HasForms
{
use InteractsWithForms;
public function acceptQuote($id, $tracking): void
{
$repair = Repair::where('id', $id)
->where('tracking_code', $tracking)
->firstOrFail();

$repair->update([
'quote_accepted' => now(),
]);

Notification::make()
->title('Quote Accepted')
->body('Your quote has been accepted on '.$repair->quote_accepted->format('d/m/Y'))
->success()
->send();

// $this->redirectRoute('livewire.confirm-quote');

}

public function render(): View
{
return view('livewire.confirm-quote');
}
}

<?php

namespace App\Livewire;

use App\Models\Repair;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Illuminate\Contracts\View\View;
use Livewire\Component;
use Filament\Notifications\Notification;

class ConfirmQuote extends Component implements HasForms
{
use InteractsWithForms;
public function acceptQuote($id, $tracking): void
{
$repair = Repair::where('id', $id)
->where('tracking_code', $tracking)
->firstOrFail();

$repair->update([
'quote_accepted' => now(),
]);

Notification::make()
->title('Quote Accepted')
->body('Your quote has been accepted on '.$repair->quote_accepted->format('d/m/Y'))
->success()
->send();

// $this->redirectRoute('livewire.confirm-quote');

}

public function render(): View
{
return view('livewire.confirm-quote');
}
}
the confirm-quote.blade.php is a button
<button wire.loading.attr="disabled" wire:click="acceptQuote({{ request()->route('id') }}, '{{ request()->route('tracking') }}')" class="flex items-center">
<button wire.loading.attr="disabled" wire:click="acceptQuote({{ request()->route('id') }}, '{{ request()->route('tracking') }}')" class="flex items-center">
everything works,the db is correctly updated, notification appears but are without style and still on the page forever it's my first custom page and 99% i'm doing something wrong
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server