I use Laravel Soft Deleting and also Type Hinting.
Is it possible to show soft-deleted models to users with appropriate privileges using type hinting. Out of the box soft-deleted models can't be type hinted (laravel throws an error).
Example Code - Routes:
Route::resource('users', 'Admin\UsersController', [
'parameters' => ['id' => 'user'],
'names' => [
'index' => 'admin.users.index',
'create' => 'admin.users.create',
'store' => 'admin.users.store',
'show' => 'admin.users.show',
'edit' => 'admin.users.edit',
'update' => 'admin.users.update',
'destroy' => 'admin.users.destroy'
]
]);
And in Admin\UsersController.php
public function show(User $user)
{
// Show the $user (also if soft deleted)
}
via sugo