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

@ -39,6 +39,10 @@ class Currencies extends ApiController
$currency = Currency::where('code', $id)->first();
}
if (! $currency instanceof Currency) {
return $this->errorInternal('No query results for model [' . Currency::class . '] ' . $id);
}
return new Resource($currency);
}