Skip to content

Commit 23fd334

Browse files
committed
feat: add missing MediaGallery trait dependencies
1 parent 1da0eab commit 23fd334

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Eclipse\Common\Filament\Forms\Components\Concerns;
4+
5+
use Closure;
6+
7+
trait CanManageMediaCollections
8+
{
9+
protected string|Closure $collection = 'default';
10+
11+
public function collection(string|Closure $collection): static
12+
{
13+
$this->collection = $collection;
14+
15+
return $this;
16+
}
17+
18+
public function getCollection(): string
19+
{
20+
return $this->evaluate($this->collection);
21+
}
22+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace Eclipse\Common\Filament\Forms\Components\Concerns;
4+
5+
use Closure;
6+
7+
trait HasMediaPreview
8+
{
9+
protected array|Closure $previewConversions = ['thumb', 'preview'];
10+
11+
protected int|Closure $previewHeight = 200;
12+
13+
protected int|Closure $previewWidth = 200;
14+
15+
public function previewConversions(array|Closure $conversions): static
16+
{
17+
$this->previewConversions = $conversions;
18+
19+
return $this;
20+
}
21+
22+
public function previewHeight(int|Closure $height): static
23+
{
24+
$this->previewHeight = $height;
25+
26+
return $this;
27+
}
28+
29+
public function previewWidth(int|Closure $width): static
30+
{
31+
$this->previewWidth = $width;
32+
33+
return $this;
34+
}
35+
36+
public function getPreviewConversions(): array
37+
{
38+
return $this->evaluate($this->previewConversions);
39+
}
40+
41+
public function getPreviewHeight(): int
42+
{
43+
return $this->evaluate($this->previewHeight);
44+
}
45+
46+
public function getPreviewWidth(): int
47+
{
48+
return $this->evaluate($this->previewWidth);
49+
}
50+
}

0 commit comments

Comments
 (0)