added model check to api show endpoints

This commit is contained in:
Denis Duliçi
2022-07-20 10:54:13 +03:00
parent ef24b51142
commit fa9be87e37
9 changed files with 37 additions and 0 deletions

View File

@ -34,6 +34,10 @@ class Items extends ApiController
{
$item = Item::with('category', 'taxes')->find($id);
if (! $item instanceof Item) {
return $this->errorInternal('No query results for model [' . Item::class . '] ' . $id);
}
return new Resource($item);
}