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

47 lines
1.2 KiB
PHP
Raw Normal View History

2023-10-02 23:10:49 +03:00
<?php
namespace Lucent\Channel;
2024-08-24 18:51:36 +03:00
use Lucent\Channel\Data\UserCommand;
2023-10-02 23:10:49 +03:00
use Lucent\Primitive\Collection;
2024-09-27 14:28:20 +03:00
use Lucent\Schema\FilesSchema;
2023-10-02 23:10:49 +03:00
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
2024-08-24 18:51:36 +03:00
* @param Collection<UserCommand> $commands
2023-10-02 23:10:49 +03:00
*/
function __construct(
2026-04-29 19:40:37 +03:00
public string $name,
public string $url,
public string $previewTarget,
2024-08-24 18:51:36 +03:00
public Collection $commands,
2023-10-02 23:10:49 +03:00
public Collection $schemas,
2026-04-29 19:40:37 +03:00
public array $imageFilters,
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")) {
2026-04-29 19:40:37 +03:00
"s3" => config("filesystems.disks.lucent.endpoint") .
"/" .
config("filesystems.disks.lucent.bucket"),
"local" => $this->url .
"/storage" .
config("filesystems.disks.lucent.endpoint"),
default => "",
2024-08-23 20:58:45 +03:00
};
2024-09-27 14:28:20 +03:00
}
2023-10-02 23:10:49 +03:00
}