where('slug', $value) ->first(); if ($workspace !== null) { return $workspace; } if (! ctype_digit($value)) { return null; } return Workspace::query()->whereKey((int) $value)->first(); } }