File tree Expand file tree Collapse file tree
src/Filament/Forms/Components/Concerns Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments