Files
lucent-laravel/src/Channel/Channel.php
T

43 lines
1.1 KiB
PHP
Raw Normal View History

2023-10-02 23:10:49 +03:00
<?php
namespace Lucent\Channel;
use Lucent\Primitive\Collection;
use Lucent\Schema\Schema;
final class Channel
{
public string $lucentUrl;
public string $filesUrl;
2023-10-06 13:07:09 +03:00
public string $previewTargetUrl;
2023-10-02 23:10:49 +03:00
/**
* @param Collection<Schema> $schemas
*/
function __construct(
public string $name,
public string $url,
2023-10-04 23:48:12 +03:00
public string $previewTarget,
public string $generateCommand,
2023-10-02 23:10:49 +03:00
public Collection $schemas,
public array $imageFilters,
2023-10-17 22:57:25 +03:00
public array $roles,
2023-10-02 23:10:49 +03:00
)
{
$this->lucentUrl = $url . "/lucent";
2024-08-23 20:58:45 +03:00
$this->filesUrl = $this->makeFilesUrl();
$this->previewTargetUrl = $url . "/" . $previewTarget;
}
private function makeFilesUrl(): string
{
return match (config("filesystems.disks.lucent.driver")) {
"s3" => config("filesystems.disks.lucent.endpoint") . "/" . config("filesystems.disks.lucent.bucket"),
"local" => $this->url . "/storage" . config("filesystems.disks.lucent.endpoint"),
};
2023-10-02 23:10:49 +03:00
}
}