the route, model binds and should throw a 404 not found. It seems like the issue is probably elsewhere.
LocationsController::class is a normal controller, then you are trying to pass a model to a Livewire component?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello guys, when i put a Model as public property on a Livewire component and load the model from database, if the model is deleted from another tab ot another browser, any interaction with the component thrown the "NOT FOUND" modal, on the docs explains how to handle the modal with Javascript, but the component still throwing the "NOT FOUND" message, the only solution i found was to force the entire page reload, but i wonder, is there anyway to handle this behaviour on PHP? Something like the "model missing" behaviuor on normal routes with controllers.
use App\Http\Controllers\LocationsController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
Route::get('/locations/{location:slug}', [LocationsController::class, 'show'])
->name('locations.view')
->missing(function (Request $request) {
return Redirect::route('locations.index');
});
I guess this because when Livewire tries to "hydrate" the component never will found a deleted post, but the Javascript side of Livewire still sending that model ID that no longer exists... I found two "solutions": reload the entire page with Javascript or avoid to use Models as properties, use an array instead and load the model just for fill the array and then fill the model back and save to database, in that way i can handle the "findOrFail" method exception and force the modal to close with "dispatchBrowserEvent", but if you know something better to handle this.
Please or to participate in this conversation.