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

@ -47,6 +47,10 @@ class Settings extends ApiController
$setting = Setting::where('key', $id)->first();
}
if (! $setting instanceof Setting) {
return $this->errorInternal('No query results for model [' . Setting::class . '] ' . $id);
}
return new Resource($setting);
}