Redirect to /dashboard on model not found

This commit is contained in:
Hillel Coren 2017-08-28 10:44:00 +03:00
parent 04bbb0ff6f
commit a8d73fe1f2

View File

@ -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;