Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

UmaWorld's avatar

Issue with delete functionality using laravel livewire

#showProposal.blade.php

namespace App\Http\Livewire;

use App\Models\Proposal; use Exception; use Livewire\Component; use Livewire\WithPagination;

class ShowProposals extends Component { use WithPagination;

public function mount()

{ $this->listeners = ['deleteProposal']; }

 public function deleteProposal($proposalId)
{
    $proposal = Proposal::find($proposalId);
    if ($proposal) {
        $proposal->delete();
        session()->flash('message', 'Proposal deleted successfully.');
        return redirect()->route('dashboard'); // Adjust the route as needed
    }
}
public function render()
{
    return view('livewire.show-proposals',[
        'proposals' => Proposal::orderBy('updated_at', 'desc')->paginate(10),
    ]);
}

}

got error ##Undefined array key "deleteProposal"

Pls anyone helpme

0 likes
4 replies
vincent15000's avatar

Can you show the entire error message with the line where it occurs in your code.

And sure the code at this line.

Please or to participate in this conversation.