1
0
mirror of https://koodu.h-i.works/projects/thebadspace synced 2025-06-25 16:04:37 -05:00

consolidated getLocation function

changed the function that retrieves a single location to decide what to
get based on the variable type, so it doesn't need to be two seperate
functions
This commit is contained in:
ro
2024-02-16 15:34:09 -06:00
parent 021a43f36a
commit 9d750fd76f
3 changed files with 13 additions and 7 deletions

View File

@ -34,9 +34,13 @@ class LocationRepository
return $results;
}
public function getLocation($uuid)
public function getLocation($type)
{
return $this->model::where("uuid", $uuid)->first();
if (!is_string($type) || (preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/', $type) !== 1)) {
return $this->model::where("url", $type)->first();
} else {
return $this->model::where("uuid", $type)->first();
}
}
public function getActiveLocations()