This is how I delete the model:
if ($this->model == 'Post')Post::find($this->recordId)->delete(); elseif
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a Livewire component that deletes models :
...
public function setRecord($model,$recordId){
$this->resetDialog();
$this->model = $model;
$this->recordId = $recordId;
}
...
setRecord is called from Blade template :
```php
@if($canDelete)
<x-jet-dropdown-link @click="Livewire.emit('setDeleteRecord','Post',{{$row->id}});">
{{ __('Delete') }}
</x-jet-dropdown-link>
<div class="border-t border-gray-100"></div>
@endif
How can I simplify pass the model from the Blade template without the manual model type "Post" and still delete the model ? Remember I plan to use the same Livewire component with different models eg Item, Location etc ?
Please or to participate in this conversation.