inertiajs / pingcrm

A demo application to illustrate how Inertia.js works.
http://demo.inertiajs.com
MIT License
2.14k stars 779 forks source link

Deleting an organization redirects to its editing page #140

Closed innocenzi closed 3 years ago

innocenzi commented 3 years ago

Which causes a 404 modal to appear, since the organization doesn't exist anymore.

tylerwiegand commented 3 years ago

The same thing is true of deleting a contact! =)

reinink commented 3 years ago

Good catch, I accidentally forgot to replace the previous logic that allowed route model binding of trashed models. This has been fixed: eb00e058d2718909a21b27efc83d714cabc937dd

darkons commented 1 year ago

Sorry for commenting on an old issue.

The resolveRouteBinding on every Model class is not necessary and also causes it not to work properly because other resource routes like show, edit and update will resolve deleted models.

You can just use withTrashed() in restore routes like this:

Route::put('users/{user}/restore', [UsersController::class, 'restore'])
    ->name('users.restore')
    ->withTrashed()
    ->middleware('auth');