Redirect to /dashboard on model not found
This commit is contained in:
parent
04bbb0ff6f
commit
a8d73fe1f2
1 changed files with 2 additions and 6 deletions
|
|
@ -40,13 +40,9 @@ class EntityRequest extends Request
|
|||
}
|
||||
|
||||
if (method_exists($class, 'trashed')) {
|
||||
$this->entity = $class::scope($publicId)->withTrashed()->first();
|
||||
$this->entity = $class::scope($publicId)->withTrashed()->firstOrFail();
|
||||
} else {
|
||||
$this->entity = $class::scope($publicId)->first();
|
||||
}
|
||||
|
||||
if (! $this->entity) {
|
||||
abort(404, "Entity: {$class} Id: {$publicId} not found");
|
||||
$this->entity = $class::scope($publicId)->firstOrFail();
|
||||
}
|
||||
|
||||
return $this->entity;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue