public function getLaunchUrlAttribute() { $launchUrl = ''; switch ($this->type) { case AppTypes::STORAGE_SERVICE: if (!empty($this->storage_service_id)) { /** @var $service Service */ $service = Service::whereId($this->storage_service_id)->first(); if (!empty($service)) { $launchUrl .= $service->name . '/'; if (!empty($this->storage_container)) { $launchUrl .= trim($this->storage_container, '/'); } if (!empty($this->path)) { $launchUrl .= '/' . ltrim($this->path, '/'); } $launchUrl = url($launchUrl); } } break; case AppTypes::PATH: $launchUrl = url($this->path); break; case AppTypes::URL: $launchUrl = $this->url; break; } return $launchUrl; }