Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Schemas/Components/FileManagerEmbed.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ class FileManagerEmbed extends Livewire

protected string|Closure $defaultViewMode = 'grid';

protected ?string $disk = null;
protected string|Closure|null $disk = null;

protected ?string $target = null;
protected string|Closure|null $target = null;

protected ?string $initialFolder = null;
protected string|Closure|null $initialFolder = null;

protected string|Closure $sidebarRootLabel = 'Root';

protected string|Closure $sidebarHeading = 'Folders';

protected string|Closure $breadcrumbsRootLabel = 'Root';

public static function make(Closure|string $component = null, Closure|array $data = []): static
public static function make(Closure|string|null $component = null, Closure|array $data = []): static
{
$static = app(static::class, [
'component' => $component ?? EmbeddedFileManager::class,
Expand Down Expand Up @@ -159,7 +159,7 @@ public function getDefaultViewMode(): string
/**
* Set the storage disk to use.
*/
public function disk(?string $disk): static
public function disk(string|Closure|null $disk): static
{
$this->disk = $disk;

Expand All @@ -171,13 +171,13 @@ public function disk(?string $disk): static
*/
public function getDisk(): ?string
{
return $this->disk;
return $this->evaluate($this->disk);
}

/**
* Set the target directory within the disk.
*/
public function target(?string $target): static
public function target(string|Closure|null $target): static
{
$this->target = $target;

Expand All @@ -189,14 +189,14 @@ public function target(?string $target): static
*/
public function getTarget(): ?string
{
return $this->target;
return $this->evaluate($this->target);
}

/**
* Set the initial folder to navigate to on load.
* For database mode, this is the folder ID.
*/
public function initialFolder(?string $folder): static
public function initialFolder(string|Closure|null $folder): static
{
$this->initialFolder = $folder;

Expand All @@ -208,7 +208,7 @@ public function initialFolder(?string $folder): static
*/
public function getInitialFolder(): ?string
{
return $this->initialFolder;
return $this->evaluate($this->initialFolder);
}

/**
Expand Down
20 changes: 10 additions & 10 deletions src/Schemas/Components/FileSystemEmbed.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ class FileSystemEmbed extends Livewire

protected string|Closure $defaultViewMode = 'grid';

protected ?string $disk = null;
protected string|Closure|null $disk = null;

protected ?string $target = null;
protected string|Closure|null $target = null;

protected ?string $initialFolder = null;
protected string|Closure|null $initialFolder = null;

protected string|Closure $sidebarRootLabel = 'Root';

protected string|Closure $sidebarHeading = 'Folders';

protected string|Closure $breadcrumbsRootLabel = 'Root';

public static function make(Closure|string $component = null, Closure|array $data = []): static
public static function make(Closure|string|null $component = null, Closure|array $data = []): static
{
$static = app(static::class, [
'component' => $component ?? EmbeddedFileSystem::class,
Expand Down Expand Up @@ -159,7 +159,7 @@ public function getDefaultViewMode(): string
/**
* Set the storage disk to use.
*/
public function disk(?string $disk): static
public function disk(string|Closure|null $disk): static
{
$this->disk = $disk;

Expand All @@ -171,13 +171,13 @@ public function disk(?string $disk): static
*/
public function getDisk(): ?string
{
return $this->disk;
return $this->evaluate($this->disk);
}

/**
* Set the target directory within the disk.
*/
public function target(?string $target): static
public function target(string|Closure|null $target): static
{
$this->target = $target;

Expand All @@ -189,14 +189,14 @@ public function target(?string $target): static
*/
public function getTarget(): ?string
{
return $this->target;
return $this->evaluate($this->target);
}

/**
* Set the initial folder path to navigate to on load.
* For storage mode, this is the folder path within the disk.
*/
public function initialFolder(?string $folder): static
public function initialFolder(string|Closure|null $folder): static
{
$this->initialFolder = $folder;

Expand All @@ -208,7 +208,7 @@ public function initialFolder(?string $folder): static
*/
public function getInitialFolder(): ?string
{
return $this->initialFolder;
return $this->evaluate($this->initialFolder);
}

/**
Expand Down