Add exception for hardware vs assets :(

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2025-02-19 03:41:01 +00:00
parent 560311b883
commit fa20eb4965

View file

@ -127,6 +127,11 @@ class Handler extends ExceptionHandler
if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
$model_name = last(explode('\\', $e->getModel()));
$route_base = str_plural(strtolower(last(explode('\\', $e->getModel()))));
// Sigh. Fucking laravel.
if ($route_base =='assets') {
$route_base = 'hardware';
}
return redirect()
->route($route_base.'.index')
->withError(trans('general.generic_model_not_found', ['model' => $model_name]));