Update logic that handles creation of folders for a server
This commit is contained in:
parent
ec87330a81
commit
95d19bf09e
13 changed files with 116 additions and 9 deletions
|
@ -26,8 +26,13 @@ class SubstituteClientApiBindings extends ApiSubstituteBindings
|
|||
// column rather than the default 'id'.
|
||||
$this->router->bind('server', function ($value) use ($request) {
|
||||
try {
|
||||
$column = 'uuidShort';
|
||||
if (preg_match('/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i', $value)) {
|
||||
$column = 'uuid';
|
||||
}
|
||||
|
||||
return Container::getInstance()->make(ServerRepositoryInterface::class)->findFirstWhere([
|
||||
['uuidShort', '=', $value],
|
||||
[$column, '=', $value],
|
||||
]);
|
||||
} catch (RecordNotFoundException $ex) {
|
||||
$request->attributes->set('is_missing_model', true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue