mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fixed handler for reports
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
82d8e1b0a9
commit
35a89de6dd
|
@ -126,14 +126,17 @@ class Handler extends ExceptionHandler
|
||||||
// The only alternative is to set that at *each* route, which is crazypants
|
// The only alternative is to set that at *each* route, which is crazypants
|
||||||
if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
|
if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
|
||||||
$model_name = last(explode('\\', $e->getModel()));
|
$model_name = last(explode('\\', $e->getModel()));
|
||||||
$route_base = str_plural(strtolower(last(explode('\\', $e->getModel()))));
|
$route = str_plural(strtolower(last(explode('\\', $e->getModel())))).'.index';
|
||||||
|
|
||||||
// Sigh. Fucking laravel.
|
// Sigh. Fucking laravel.
|
||||||
if ($route_base == 'assets') {
|
if ($route == 'assets.index') {
|
||||||
$route_base = 'hardware';
|
$route = 'hardware.index';
|
||||||
|
} elseif ($route == 'reporttemplates.index') {
|
||||||
|
$route = 'reports/custom';
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route($route_base.'.index')
|
->route($route)
|
||||||
->withError(trans('general.generic_model_not_found', ['model' => $model_name]));
|
->withError(trans('general.generic_model_not_found', ['model' => $model_name]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue