Andrew преди 2 месеца
родител
ревизия
226d5ca3cb

+ 4
- 7
app/Filament/Resources/AlbumResource.php Целия файл

@@ -59,22 +59,19 @@ class AlbumResource extends Resource
59 59
                     ])->columnSpanFull()->columns(2),
60 60
                     FileUpload::make('news_banner')->label('列表大圖')
61 61
                         ->directory('album/img')
62
-                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])
63
-                        ->helperText('建議寬高限制為:2000*720px,出血寬度720px,主要圖像範圍為:1280*720px,檔案大小限制為1M以下')->maxSize('1024'),
62
+                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor(),
64 63
                     FileUpload::make('news_img_pc')->label('列表圖(desktop)')
65 64
                         ->directory('album/img')
66
-                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])
67
-                        ->helperText('建議寬高限制為:1280*720px,檔案大小限制為1M以下')->maxSize('1024'),
65
+                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor(),
68 66
                     FileUpload::make('news_img_mobile')->label('列表圖(mobile)')
69 67
                         ->directory('album/img')
70
-                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])
71
-                        ->helperText('建議寬高限制為:600x896px,檔案大小限制為1M以下')->maxSize('1024'),
68
+                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor(),
72 69
                     Translate::make()->schema(fn (string $locale) => [
73 70
                         TextInput::make('title')
74 71
                             ->label('標題')
75 72
                             ->columnSpan(1),
76 73
                     ])
77
-                        ->locales(['zh_TW', 'en', 'jp'])
74
+                        ->locales(['zh_TW', 'en'])
78 75
                         ->actions([
79 76
                             app(DeepLService::class)->createTranslationAction('Main', ['title']),
80 77
                         ])

+ 19
- 23
app/Filament/Resources/BadgeResource.php Целия файл

@@ -2,28 +2,20 @@
2 2
 
3 3
 namespace App\Filament\Resources;
4 4
 
5
-use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
6 5
 use App\Filament\Resources\BadgeResource\Pages;
7
-use App\Service\DeepLService;
8
-use App\Filament\Resources\BadgeResource\RelationManagers;
9 6
 use App\Models\Badge;
10
-use Filament\Forms;
11
-use Filament\Forms\Components\DatePicker;
7
+use App\Service\DeepLService;
12 8
 use Filament\Forms\Components\FileUpload;
13 9
 use Filament\Forms\Components\Group;
14 10
 use Filament\Forms\Components\Radio;
15 11
 use Filament\Forms\Components\Section;
16
-use Filament\Forms\Components\Select;
17 12
 use Filament\Forms\Components\TextInput;
18 13
 use Filament\Forms\Form;
19 14
 use Filament\Resources\Resource;
20 15
 use Filament\Tables;
21 16
 use Filament\Tables\Columns\ImageColumn;
22 17
 use Filament\Tables\Columns\TextColumn;
23
-use Filament\Tables\Columns\TextInputColumn;
24 18
 use Filament\Tables\Table;
25
-use Illuminate\Database\Eloquent\Builder;
26
-use Illuminate\Database\Eloquent\SoftDeletingScope;
27 19
 use SolutionForest\FilamentTranslateField\Forms\Component\Translate;
28 20
 
29 21
 class BadgeResource extends Resource
@@ -31,9 +23,12 @@ class BadgeResource extends Resource
31 23
     protected static ?string $model = Badge::class;
32 24
 
33 25
     protected static ?string $navigationIcon = 'heroicon-o-check-badge';
26
+
34 27
     protected static ?string $navigationGroup = '其他設定';
35
-    protected static ?string $navigationLabel = "認證標章管理";
36
-    protected static ?string $modelLabel = "認證標章管理";
28
+
29
+    protected static ?string $navigationLabel = '認證標章管理';
30
+
31
+    protected static ?string $modelLabel = '認證標章管理';
37 32
 
38 33
     // 預設排序
39 34
     protected static function booted()
@@ -47,26 +42,27 @@ class BadgeResource extends Resource
47 42
     {
48 43
         return $form
49 44
             ->schema([
50
-                Section::make("")->schema([
45
+                Section::make('')->schema([
51 46
                     Group::make()->schema([
52 47
                         Group::make()->schema([
53 48
                             Translate::make()->schema(fn (string $locale) => [
54
-                                TextInput::make('title')->required($locale == 'zh_TW')->maxLength(40)->label("徽章標題")
49
+                                TextInput::make('title')->required($locale == 'zh_TW')->maxLength(40)->label('徽章標題'),
55 50
                             ])
56
-                            ->locales(["zh_TW", "en"])
57
-                            ->actions([
58
-                                app(DeepLService::class)->createTranslationAction("Main", ["title"])
59
-                            ])->columnSpan(1),
51
+                                ->locales(['zh_TW', 'en'])
52
+                                ->actions([
53
+                                    app(DeepLService::class)->createTranslationAction('Main', ['title']),
54
+                                ])->columnSpan(1),
60 55
                         ])->columns(2)->columnSpanFull(),
61 56
                         Group::make()->schema([
62
-                            FileUpload::make("img_url")->label("圖片")->directory("badge")->columnSpan(1),
57
+                            FileUpload::make('img_url')->label('圖片')->directory('badge')->columnSpan(1)
58
+                                ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor(),
63 59
                         ])->columnSpanFull(),
64 60
                     ])->columns(4)->columnSpanFull(),
65 61
                     Group::make()->schema([
66
-                        Radio::make("visible")->label("顯示/不顯示")->options([1 => "顯示", 0 => "不顯示"])->inline()->default(1)
67
-                        ->columnSpan(2)
62
+                        Radio::make('visible')->label('顯示/不顯示')->options([1 => '顯示', 0 => '不顯示'])->inline()->default(1)
63
+                            ->columnSpan(2),
68 64
                     ])->columns(4)->columnSpanFull(),
69
-                ])
65
+                ]),
70 66
             ]);
71 67
     }
72 68
 
@@ -75,8 +71,8 @@ class BadgeResource extends Resource
75 71
         return $table
76 72
             ->columns([
77 73
                 //
78
-                TextColumn::make("title")->label("徽章標題"),
79
-                ImageColumn::make('img_url')->label("圖片")
74
+                TextColumn::make('title')->label('徽章標題'),
75
+                ImageColumn::make('img_url')->label('圖片'),
80 76
             ])
81 77
             ->filters([
82 78
                 //

+ 30
- 28
app/Filament/Resources/BannerResource.php Целия файл

@@ -2,12 +2,9 @@
2 2
 
3 3
 namespace App\Filament\Resources;
4 4
 
5
-use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
6 5
 use App\Filament\Resources\BannerResource\Pages;
7
-use App\Service\DeepLService;
8
-use App\Filament\Resources\BannerResource\RelationManagers;
9 6
 use App\Models\Banner;
10
-use Filament\Forms;
7
+use App\Service\DeepLService;
11 8
 use Filament\Forms\Components\FileUpload;
12 9
 use Filament\Forms\Components\Group;
13 10
 use Filament\Forms\Components\Radio;
@@ -20,19 +17,22 @@ use Filament\Tables;
20 17
 use Filament\Tables\Columns\ImageColumn;
21 18
 use Filament\Tables\Columns\TextColumn;
22 19
 use Filament\Tables\Table;
23
-use Illuminate\Database\Eloquent\Builder;
24
-use Illuminate\Database\Eloquent\SoftDeletingScope;
25 20
 use SolutionForest\FilamentTranslateField\Forms\Component\Translate;
26 21
 
27 22
 class BannerResource extends Resource
28 23
 {
29 24
     protected static ?string $model = Banner::class;
25
+
30 26
     protected static ?int $navigationSort = 1;
27
+
31 28
     protected static ?string $navigationIcon = 'heroicon-o-photo';
29
+
32 30
     protected static ?string $navigationGroup = '其他設定';
31
+
33 32
     // protected static ?string $navigationGroup = '上稿內容管理';
34
-    protected static ?string $navigationLabel = "首頁 Banner 管理";
35
-    protected static ?string $modelLabel = "首頁 Banner 管理";
33
+    protected static ?string $navigationLabel = '首頁 Banner 管理';
34
+
35
+    protected static ?string $modelLabel = '首頁 Banner 管理';
36 36
 
37 37
     // 預設排序
38 38
     protected static function booted()
@@ -47,32 +47,34 @@ class BannerResource extends Resource
47 47
         return $form
48 48
             ->schema([
49 49
                 //
50
-                Section::make("")->schema([
50
+                Section::make('')->schema([
51 51
                     Group::make()->schema([
52 52
                         Translate::make()->schema(fn (string $locale) => [
53
-                            Textarea::make('title')->required($locale == 'zh_TW')->label("大字標題"),
54
-                            Textarea::make('content')->required($locale == 'zh_TW')->label("小字標題")
53
+                            Textarea::make('title')->required($locale == 'zh_TW')->label('大字標題'),
54
+                            Textarea::make('content')->required($locale == 'zh_TW')->label('小字標題'),
55 55
                         ])
56
-                        ->locales(["zh_TW", "en"])
57
-                        ->actions([
58
-                            app(DeepLService::class)->createTranslationAction("Main", ["title", "content"])
59
-                        ])->columnSpanFull(),
60
-                        Radio::make("type")->label("")->default(1)->options([1 => "圖片", 2 => "影片"]),
56
+                            ->locales(['zh_TW', 'en'])
57
+                            ->actions([
58
+                                app(DeepLService::class)->createTranslationAction('Main', ['title', 'content']),
59
+                            ])->columnSpanFull(),
60
+                        Radio::make('type')->label('')->default(1)->options([1 => '圖片', 2 => '影片']),
61 61
                         Group::make()->schema([
62
-                            FileUpload::make("img_url")->label("圖片")->directory("banners")->columnSpan(1),
63
-                            FileUpload::make("mobile_img")->label("手機板圖片")->directory("banners")->columnSpan(1),
62
+                            FileUpload::make('img_url')->label('圖片')->directory('banners')->columnSpan(1)
63
+                                ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor(),
64
+                            FileUpload::make('mobile_img')->label('手機板圖片')->directory('banners')->columnSpan(1)
65
+                                ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor(),
64 66
                             Translate::make()->schema(fn (string $locale) => [
65
-                                TextInput::make('img_alt')->required($locale == 'zh_TW')->label("圖片註釋")
67
+                                TextInput::make('img_alt')->required($locale == 'zh_TW')->label('圖片註釋'),
66 68
                             ])
67
-                            ->locales(["zh_TW", "en"])
68
-                            ->actions([
69
-                                app(DeepLService::class)->createTranslationAction("Main", ["img_alt"])
70
-                            ])->columnSpan(1),
69
+                                ->locales(['zh_TW', 'en'])
70
+                                ->actions([
71
+                                    app(DeepLService::class)->createTranslationAction('Main', ['img_alt']),
72
+                                ])->columnSpan(1),
71 73
                         ])->columnSpanFull(),
72
-                        Radio::make("visible")->label("顯示/不顯示")->options([1 => "顯示", 0 => "不顯示"])->inline()->default(1)->columnSpan(2),
73
-                        TextInput::make('order')->label("排序")->default("0")
74
+                        Radio::make('visible')->label('顯示/不顯示')->options([1 => '顯示', 0 => '不顯示'])->inline()->default(1)->columnSpan(2),
75
+                        TextInput::make('order')->label('排序')->default('0'),
74 76
                     ])->columns(4)->columnSpanFull(),
75
-                ])
77
+                ]),
76 78
             ]);
77 79
     }
78 80
 
@@ -81,8 +83,8 @@ class BannerResource extends Resource
81 83
         return $table
82 84
             ->columns([
83 85
                 //
84
-                ImageColumn::make('img_url')->label("圖片"),
85
-                TextColumn::make("title")->label("標題")
86
+                ImageColumn::make('img_url')->label('圖片'),
87
+                TextColumn::make('title')->label('標題'),
86 88
             ])
87 89
             ->filters([
88 90
                 //

+ 51
- 46
app/Filament/Resources/HistoryResource.php Целия файл

@@ -3,10 +3,8 @@
3 3
 namespace App\Filament\Resources;
4 4
 
5 5
 use App\Filament\Resources\HistoryResource\Pages;
6
-use App\Service\DeepLService;
7
-use App\Filament\Resources\HistoryResource\RelationManagers;
8 6
 use App\Models\History;
9
-use Filament\Forms;
7
+use App\Service\DeepLService;
10 8
 use Filament\Forms\Components\FileUpload;
11 9
 use Filament\Forms\Components\Group;
12 10
 use Filament\Forms\Components\Radio;
@@ -21,7 +19,6 @@ use Filament\Tables\Columns\TextColumn;
21 19
 use Filament\Tables\Filters\SelectFilter;
22 20
 use Filament\Tables\Table;
23 21
 use Illuminate\Database\Eloquent\Builder;
24
-use Illuminate\Database\Eloquent\SoftDeletingScope;
25 22
 use SolutionForest\FilamentTranslateField\Forms\Component\Translate;
26 23
 
27 24
 class HistoryResource extends Resource
@@ -29,46 +26,53 @@ class HistoryResource extends Resource
29 26
     protected static ?string $model = History::class;
30 27
 
31 28
     protected static ?string $navigationIcon = 'heroicon-o-list-bullet';
32
-    protected static ?string $navigationLabel = "宏匯里程管理";
29
+
30
+    protected static ?string $navigationLabel = '宏匯里程管理';
31
+
33 32
     protected static ?string $navigationGroup = '關於宏匯';
34
-    protected static ?string $modelLabel = "宏匯里程管理";
33
+
34
+    protected static ?string $modelLabel = '宏匯里程管理';
35
+
35 36
     public ?string $tableSortColumn = null;
37
+
36 38
     public ?string $tableSortDirection = null;
37 39
 
38 40
     public static function form(Form $form): Form
39 41
     {
40 42
         return $form
41 43
             ->schema([
42
-                Section::make("")->schema([
43
-                    Select::make("selected_year")->label("年份")->options(function () {
44
+                Section::make('')->schema([
45
+                    Select::make('selected_year')->label('年份')->options(function () {
44 46
                         $currentYear = now()->year;
45 47
                         $years = [];
46 48
                         for ($i = $currentYear - 15; $i <= $currentYear + 5; $i++) {
47
-                            $years[$i] = strval($i) . '年';
49
+                            $years[$i] = strval($i).'年';
48 50
                         }
49 51
 
50 52
                         return $years;
51 53
                     })->columnSpan(1),
52
-                    Select::make("selected_month")->label("月份")->options(function (){
54
+                    Select::make('selected_month')->label('月份')->options(function () {
53 55
                         $months = [];
54
-                        for($i=1;$i<=12 ;$i++){
55
-                            $months[$i] = strval($i) . "月";
56
+                        for ($i = 1; $i <= 12; $i++) {
57
+                            $months[$i] = strval($i).'月';
56 58
                         }
59
+
57 60
                         return $months;
58 61
                     })->default(now()->month)->columnSpan(1),
59 62
                     Translate::make()->schema(fn (string $locale) => [
60
-                        TextInput::make('title')->required($locale == 'zh_TW')->label("標題"),
63
+                        TextInput::make('title')->required($locale == 'zh_TW')->label('標題'),
61 64
                     ])
62
-                    ->locales(["zh_TW", "en"])
63
-                    ->actions([
64
-                        app(DeepLService::class)->createTranslationAction("Main", ["title"])
65
-                    ])->columnSpanFull(),
65
+                        ->locales(['zh_TW', 'en'])
66
+                        ->actions([
67
+                            app(DeepLService::class)->createTranslationAction('Main', ['title']),
68
+                        ])->columnSpanFull(),
66 69
                     Group::make()->schema([
67
-                        FileUpload::make("img_url")->label("圖片")->directory("histories")
68
-                        ->columnSpanFull(),
70
+                        FileUpload::make('img_url')->label('圖片')->directory('histories')
71
+                            ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor()
72
+                            ->columnSpanFull(),
69 73
                     ])->columnSpanFull(),
70
-                    Radio::make("visible")->label("顯示/不顯示")->options([1 => "顯示", 0 => "不顯示"])->inline()->default(1)->columnSpan(2)
71
-                ])->columns(3)
74
+                    Radio::make('visible')->label('顯示/不顯示')->options([1 => '顯示', 0 => '不顯示'])->inline()->default(1)->columnSpan(2),
75
+                ])->columns(3),
72 76
             ]);
73 77
     }
74 78
 
@@ -76,33 +80,34 @@ class HistoryResource extends Resource
76 80
     {
77 81
         return $table
78 82
             ->columns([
79
-                TextColumn::make("selected_year")->label("年份")->alignCenter(),
80
-                TextColumn::make("selected_month")->label("月份")->alignCenter(),
81
-                TextColumn::make("title")->label("標題"),
82
-                ImageColumn::make("img_url")->label("圖片")->disk(config("filesystem.default"))->alignCenter(),
83
+                TextColumn::make('selected_year')->label('年份')->alignCenter(),
84
+                TextColumn::make('selected_month')->label('月份')->alignCenter(),
85
+                TextColumn::make('title')->label('標題'),
86
+                ImageColumn::make('img_url')->label('圖片')->disk(config('filesystem.default'))->alignCenter(),
83 87
             ])
84 88
             ->filters([
85
-                SelectFilter::make('selected_year')->label("年份")
86
-                ->options(function () {
87
-                    $currentYear = now()->year;
88
-                    $years = [];
89
-                    // 從 10 年前到 5 年後
90
-                    for ($i = $currentYear - 10; $i <= $currentYear + 10; $i++) {
91
-                        $years[$i] = strval($i) . '年';
92
-                    }
93
-
94
-                    return $years;
95
-                })
96
-                ->attribute('selected_year'),
97
-                SelectFilter::make('selected_month')->label("月份")
98
-                ->options(function () {
99
-                    $months = [];
100
-                    for($i=1;$i<=12 ;$i++){
101
-                        $months[$i] = strval($i) . "月";
102
-                    }
103
-                    return $months;
104
-                })
105
-                ->attribute('selected_month'),
89
+                SelectFilter::make('selected_year')->label('年份')
90
+                    ->options(function () {
91
+                        $currentYear = now()->year;
92
+                        $years = [];
93
+                        // 從 10 年前到 5 年後
94
+                        for ($i = $currentYear - 10; $i <= $currentYear + 10; $i++) {
95
+                            $years[$i] = strval($i).'年';
96
+                        }
97
+
98
+                        return $years;
99
+                    })
100
+                    ->attribute('selected_year'),
101
+                SelectFilter::make('selected_month')->label('月份')
102
+                    ->options(function () {
103
+                        $months = [];
104
+                        for ($i = 1; $i <= 12; $i++) {
105
+                            $months[$i] = strval($i).'月';
106
+                        }
107
+
108
+                        return $months;
109
+                    })
110
+                    ->attribute('selected_month'),
106 111
             ])
107 112
             ->actions([
108 113
                 Tables\Actions\EditAction::make(),

+ 152
- 151
app/Filament/Resources/NewsResource.php Целия файл

@@ -2,12 +2,10 @@
2 2
 
3 3
 namespace App\Filament\Resources;
4 4
 
5
-use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
6 5
 use App\Filament\Resources\NewsResource\Pages;
7
-use App\Filament\Resources\NewsResource\RelationManagers;
8 6
 use App\Models\News;
9 7
 use App\Models\NewsCategory;
10
-use Filament\Forms;
8
+use App\Service\DeepLService;
11 9
 use Filament\Forms\Components\DatePicker;
12 10
 use Filament\Forms\Components\FileUpload;
13 11
 use Filament\Forms\Components\Group;
@@ -30,115 +28,120 @@ use Filament\Tables\Columns\TextColumn;
30 28
 use Filament\Tables\Filters\SelectFilter;
31 29
 use Filament\Tables\Table;
32 30
 use Illuminate\Database\Eloquent\Builder;
33
-use Illuminate\Database\Eloquent\SoftDeletingScope;
34 31
 use Illuminate\Support\Str;
35 32
 use Malzariey\FilamentLexicalEditor\Enums\ToolbarItem;
36
-use Malzariey\FilamentLexicalEditor\FilamentLexicalEditor;
37 33
 use SolutionForest\FilamentTranslateField\Forms\Component\Translate;
38
-use App\Service\DeepLService;
39 34
 
40 35
 class NewsResource extends Resource
41 36
 {
42 37
     protected static ?string $model = News::class;
43 38
 
44 39
     protected static ?string $navigationIcon = 'heroicon-o-newspaper';
45
-    protected static ?string $navigationLabel = "最新消息管理";
40
+
41
+    protected static ?string $navigationLabel = '最新消息管理';
42
+
46 43
     protected static ?string $navigationGroup = '最新消息';
47
-    protected static ?string $modelLabel = "最新消息管理";
44
+
45
+    protected static ?string $modelLabel = '最新消息管理';
46
+
48 47
     protected static ?int $navigationSort = 3;
49 48
 
50 49
     public static function form(Form $form): Form
51 50
     {
52
-        $editor_toolbar= [
51
+        $editor_toolbar = [
53 52
             ToolbarItem::UNDO, ToolbarItem::REDO, ToolbarItem::NORMAL,
54 53
             ToolbarItem::H2, ToolbarItem::H3, ToolbarItem::H4, ToolbarItem::H5,
55 54
             ToolbarItem::BULLET, ToolbarItem::NUMBERED, ToolbarItem::FONT_SIZE,
56 55
             ToolbarItem::BOLD, ToolbarItem::ITALIC, ToolbarItem::UNDERLINE,
57 56
             ToolbarItem::LINK, ToolbarItem::TEXT_COLOR, ToolbarItem::BACKGROUND_COLOR,
58 57
             ToolbarItem::SUBSCRIPT, ToolbarItem::LOWERCASE, ToolbarItem::DIVIDER,
59
-            ToolbarItem::UPPERCASE, ToolbarItem::CLEAR, ToolbarItem::HR
58
+            ToolbarItem::UPPERCASE, ToolbarItem::CLEAR, ToolbarItem::HR,
60 59
         ];
60
+
61 61
         return $form
62 62
             ->schema([
63 63
                 //
64 64
                 Tabs::make()->schema([
65
-                    Tab::make("基本資訊")->schema([
66
-                        Select::make("news_category_id")->label("分類")->options(function (){
67
-                            return NewsCategory::pluck("name", "id");
65
+                    Tab::make('基本資訊')->schema([
66
+                        Select::make('news_category_id')->label('分類')->options(function () {
67
+                            return NewsCategory::pluck('name', 'id');
68 68
                         })->required()
69
-                        ->columnSpan(1),
70
-                        DatePicker::make("post_date")->label("發佈日")
71
-                        ->native(false)
72
-                        ->closeOnDateSelection()
73
-                        ->columnSpan(1),
74
-                        Translate::make()->schema(fn (string $locale) => [
75
-                            TextInput::make("title")->required($locale == 'zh_TW')->label("標題")->columnSpan(1),
76
-                            TextInput::make("written_by")->required($locale == 'zh_TW')->label("撰文者")->columnSpan(1),
77
-                            Textarea::make("description")->required($locale == 'zh_TW')->label("簡述")->columnSpan(2)
69
+                            ->columnSpan(1),
70
+                        DatePicker::make('post_date')->label('發佈日')
71
+                            ->native(false)
72
+                            ->closeOnDateSelection()
73
+                            ->columnSpan(1),
74
+                        Translate::make()->schema(fn(string $locale) => [
75
+                            TextInput::make('title')->required($locale == 'zh_TW')->label('標題')->columnSpan(1),
76
+                            TextInput::make('written_by')->required($locale == 'zh_TW')->label('撰文者')->columnSpan(1),
77
+                            Textarea::make('description')->required($locale == 'zh_TW')->label('簡述')->columnSpan(2),
78 78
                         ])
79
-                        ->locales(["zh_TW", "en"])
80
-                        ->actions([
81
-                            app(DeepLService::class)->createTranslationAction("Main", ["title", "written_by", "description"])
82
-                        ])->columns(2)
83
-                        ->columnSpan(2)
84
-                        ->id("Main-content"),
85
-                        FileUpload::make("news_img")->label("圖片")
86
-                        ->directory("news")
87
-                        ->columnSpan(2),
88
-                        Translate::make()->schema(fn (string $locale) => [
89
-                            TextInput::make('news_img_alt')->label("圖片註釋")
79
+                            ->locales(['zh_TW', 'en'])
80
+                            ->actions([
81
+                                app(DeepLService::class)->createTranslationAction('Main', ['title', 'written_by', 'description']),
82
+                            ])->columns(2)
83
+                            ->columnSpan(2)
84
+                            ->id('Main-content'),
85
+                        FileUpload::make('news_img')->label('圖片')
86
+                            ->directory('news')
87
+                            ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor()
88
+                            ->columnSpan(2),
89
+                        Translate::make()->schema(fn(string $locale) => [
90
+                            TextInput::make('news_img_alt')->label('圖片註釋'),
90 91
                         ])
91
-                        ->locales(["zh_TW", "en"])
92
-                        ->actions([
93
-                            app(DeepLService::class)->createTranslationAction("NewsImageAlt", ["news_img_alt"])
94
-                        ])->columnSpan(2)
95
-                        ->id("Main-alt"),
92
+                            ->locales(['zh_TW', 'en'])
93
+                            ->actions([
94
+                                app(DeepLService::class)->createTranslationAction('NewsImageAlt', ['news_img_alt']),
95
+                            ])->columnSpan(2)
96
+                            ->id('Main-alt'),
96 97
                     ])->columns(2),
97
-                    Tab::make("SEO")->schema([
98
-                        Translate::make()->schema(fn (string $locale) => [
99
-                            TextInput::make("meta_title")->label("SEO 標題"),
100
-                            TextInput::make("meta_keyword")->label("SEO 關鍵字"),
101
-                            Textarea::make("meta_description")->label("SEO 簡述")
98
+                    Tab::make('SEO')->schema([
99
+                        Translate::make()->schema(fn(string $locale) => [
100
+                            TextInput::make('meta_title')->label('SEO 標題'),
101
+                            TextInput::make('meta_keyword')->label('SEO 關鍵字'),
102
+                            Textarea::make('meta_description')->label('SEO 簡述'),
102 103
                         ])
103
-                        ->locales(["zh_TW", "en"])
104
-                        ->actions([
105
-                            app(DeepLService::class)->createTranslationAction("Seo", ["meta_title", "meta_keyword", "meta_description"])
106
-                        ])->columnSpanFull(),
107
-                        FileUpload::make('meta_img')->label("放大預覽圖")
108
-                        ->directory("news/seo")
109
-                        ->columnSpan(1)
110
-                        ->id("Seo"),
104
+                            ->locales(['zh_TW', 'en'])
105
+                            ->actions([
106
+                                app(DeepLService::class)->createTranslationAction('Seo', ['meta_title', 'meta_keyword', 'meta_description']),
107
+                            ])->columnSpanFull(),
108
+                        FileUpload::make('meta_img')->label('放大預覽圖')
109
+                            ->directory('news/seo')
110
+                            ->columnSpan(1)
111
+                            ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor()
112
+                            ->id('Seo'),
111 113
                     ]),
112
-                    Tab::make("內文編輯")->schema([
113
-                        Repeater::make("paragraphs")->schema([
114
+                    Tab::make('內文編輯')->schema([
115
+                        Repeater::make('paragraphs')->schema([
114 116
                             TextInput::make('item_key')
115
-                                ->default(fn () => Str::random())
117
+                                ->default(fn() => Str::random())
116 118
                                 ->hidden()
117 119
                                 ->afterStateHydrated(function (TextInput $component, $state) {
118 120
                                     if (empty($state)) {
119 121
                                         $component->state(Str::random());
120 122
                                     }
121 123
                                 }),
122
-                            Radio::make("paragraph_type")->options([
123
-                                1 => "圖片",
124
-                                2 => "文字",
124
+                            Radio::make('paragraph_type')->options([
125
+                                1 => '圖片',
126
+                                2 => '文字',
125 127
                                 // 3 => "影音"
126
-                            ])->label("")->inline()->default(1)->Live(),
128
+                            ])->label('')->inline()->default(1)->Live(),
127 129
                             Group::make()->schema([
128 130
                                 Section::make('')->schema([
129
-                                    FileUpload::make('img_url')->label("")->directory("news/paragraphs"),
130
-                                    Translate::make()->schema(fn (string $locale) => [
131
-                                        TextInput::make('img_alt')->label("圖片註釋")
131
+                                    FileUpload::make('img_url')->label('')->directory('news/paragraphs')
132
+                                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor(),
133
+                                    Translate::make()->schema(fn(string $locale) => [
134
+                                        TextInput::make('img_alt')->label('圖片註釋'),
132 135
                                     ])
133
-                                    ->locales(["zh_TW", "en"])
134
-                                    ->actions([
135
-                                        app(DeepLService::class)->createTranslationAction("ParagraphImgAlt", ["img_alt"])
136
-                                    ])->columnSpan(1)
137
-                                    ->id(fn ($get) => "para_img_" . $get('item_key')),
138
-                                ])
139
-                            ])->visible(fn (Get $get):bool => $get("paragraph_type") == 1),
136
+                                        ->locales(['zh_TW', 'en'])
137
+                                        ->actions([
138
+                                            app(DeepLService::class)->createTranslationAction('ParagraphImgAlt', ['img_alt']),
139
+                                        ])->columnSpan(1)
140
+                                        ->id(fn($get) => 'para_img_' . $get('item_key')),
141
+                                ]),
142
+                            ])->visible(fn(Get $get): bool => $get('paragraph_type') == 1),
140 143
                             Group::make()->schema([
141
-                                Translate::make()->schema(fn (string $locale) => [
144
+                                Translate::make()->schema(fn(string $locale) => [
142 145
                                     RichEditor::make('text_content')
143 146
                                         ->toolbarButtons([
144 147
                                             'blockquote',
@@ -162,21 +165,21 @@ class NewsResource extends Resource
162 165
                                         ->fileAttachmentsDisk('s3')
163 166
                                         ->fileAttachmentsDirectory('attachments')
164 167
                                         ->fileAttachmentsVisibility('private'),
165
-                                        ])
166
-                                ->locales(["zh_TW", "en"])
167
-                                ->actions([
168
-                                    app(DeepLService::class)->createTranslationAction("ParagraphText", ["text_content"])
169
-                                ])->columnSpan(1)
170
-                                ->id(fn ($get) => "para_text_" . $get('item_key')),
171
-                            ])->visible(fn (Get $get):bool => $get("paragraph_type") == 2),
168
+                                ])
169
+                                    ->locales(['zh_TW', 'en'])
170
+                                    ->actions([
171
+                                        app(DeepLService::class)->createTranslationAction('ParagraphText', ['text_content']),
172
+                                    ])->columnSpan(1)
173
+                                    ->id(fn($get) => 'para_text_' . $get('item_key')),
174
+                            ])->visible(fn(Get $get): bool => $get('paragraph_type') == 2),
172 175
                         ])
173
-                        ->relationship("paragraphs")
174
-                        ->label("段落")
175
-                        ->collapsible()
176
-                        ->reorderableWithButtons()
177
-                        ->orderColumn('order')
178
-                        ->cloneable()
179
-                    ])
176
+                            ->relationship('paragraphs')
177
+                            ->label('段落')
178
+                            ->collapsible()
179
+                            ->reorderableWithButtons()
180
+                            ->orderColumn('order')
181
+                            ->cloneable(),
182
+                    ]),
180 183
                 ])->columnSpanFull(),
181 184
             ]);
182 185
     }
@@ -186,80 +189,78 @@ class NewsResource extends Resource
186 189
         return $table
187 190
             ->columns([
188 191
                 //
189
-                TextColumn::make("newsCategory.name")->label("分類")->alignCenter(),
190
-                TextColumn::make("title")->label("標題")->alignCenter(),
191
-                TextColumn::make("written_by")->label("發佈者")->alignCenter(),
192
-                TextColumn::make("post_date")->label("發佈時間")->dateTime('Y/m/d')->alignCenter(),
193
-                ImageColumn::make("news_img")->label("列表圖")->alignCenter(),
194
-                TextColumn::make("list_audit_state")->label("狀態")->badge()
195
-                ->color(fn (string $state): string => match ($state) {
196
-                    '暫存' => 'warning',
197
-                    '已發佈' => 'success',
198
-                }),
199
-                IconColumn::make("on_top")->label("置頂")
200
-                ->color(fn (string $state): string => match ($state) {
201
-                    1 => 'success',
202
-                    default => ''
203
-                })
204
-                ->icon(fn (string $state): string => match ($state) {
205
-                    1 => 'heroicon-o-check-circle',
206
-                    default => ''
207
-                })
208
-                ->action(function ($record): void {
209
-                    $record->on_top = !$record->on_top;
210
-                    $record->save();
211
-                }),
212
-                TextColumn::make("created_at")->label("建立時間")->dateTime('Y/m/d H:i:s')->alignCenter(),
213
-                TextColumn::make("updated_at")->label("更新時間")->dateTime()->alignCenter(),
192
+                TextColumn::make('newsCategory.name')->label('分類')->alignCenter(),
193
+                TextColumn::make('title')->label('標題')->alignCenter(),
194
+                TextColumn::make('written_by')->label('發佈者')->alignCenter(),
195
+                TextColumn::make('post_date')->label('發佈時間')->dateTime('Y/m/d')->alignCenter(),
196
+                ImageColumn::make('news_img')->label('列表圖')->alignCenter(),
197
+                TextColumn::make('list_audit_state')->label('狀態')->badge()
198
+                    ->color(fn(string $state): string => match ($state) {
199
+                        '暫存' => 'warning',
200
+                        '已發佈' => 'success',
201
+                    }),
202
+                IconColumn::make('on_top')->label('置頂')
203
+                    ->color(fn(string $state): string => match ($state) {
204
+                        1 => 'success',
205
+                        default => ''
206
+                    })
207
+                    ->icon(fn(string $state): string => match ($state) {
208
+                        1 => 'heroicon-o-check-circle',
209
+                        default => ''
210
+                    })
211
+                    ->action(function ($record): void {
212
+                        $record->on_top = !$record->on_top;
213
+                        $record->save();
214
+                    }),
215
+                TextColumn::make('created_at')->label('建立時間')->dateTime('Y/m/d H:i:s')->alignCenter(),
216
+                TextColumn::make('updated_at')->label('更新時間')->dateTime()->alignCenter(),
214 217
             ])
215 218
             ->filters([
216
-                SelectFilter::make('news_category_id')->label("分類")
217
-                ->options(NewsCategory::orderBy("order")->pluck("name", "id"))
218
-                ->attribute('news_category_id'),
219
-                SelectFilter::make('post_date')->label("年份")
220
-                ->options(News::select(\DB::raw("DATE_FORMAT(post_date, '%Y') as year"))->whereNotNull("post_date")->distinct()->pluck("year","year")->toArray())
221
-                ->query(
222
-                    fn (array $data, Builder $query): Builder =>
223
-                    $query->when(
224
-                        $data['value'],
225
-                        fn (Builder $query, $value): Builder => $query->where('post_date', 'like', $data['value']. "%")
226
-                    )
227
-                ),
228
-                SelectFilter::make('visible')->label("狀態")
229
-                ->options([
230
-                    0 => "暫存",
231
-                    1 => "已發佈",
232
-                ])
233
-                ->query(
234
-                    fn (array $data, Builder $query): Builder =>
235
-                    $query->when(
236
-                        $data['value'],
237
-                        fn (Builder $query, $value): Builder => $query->where('visible', $data['value'])
238
-                    )
239
-                ),
219
+                SelectFilter::make('news_category_id')->label('分類')
220
+                    ->options(NewsCategory::orderBy('order')->pluck('name', 'id'))
221
+                    ->attribute('news_category_id'),
222
+                SelectFilter::make('post_date')->label('年份')
223
+                    ->options(News::select(\DB::raw("DATE_FORMAT(post_date, '%Y') as year"))->whereNotNull('post_date')->distinct()->pluck('year', 'year')->toArray())
224
+                    ->query(
225
+                        fn(array $data, Builder $query): Builder => $query->when(
226
+                            $data['value'],
227
+                            fn(Builder $query, $value): Builder => $query->where('post_date', 'like', $data['value'] . '%')
228
+                        )
229
+                    ),
230
+                SelectFilter::make('visible')->label('狀態')
231
+                    ->options([
232
+                        0 => '暫存',
233
+                        1 => '已發佈',
234
+                    ])
235
+                    ->query(
236
+                        fn(array $data, Builder $query): Builder => $query->when(
237
+                            $data['value'],
238
+                            fn(Builder $query, $value): Builder => $query->where('visible', $data['value'])
239
+                        )
240
+                    ),
240 241
             ])
241 242
             ->actions([
242 243
                 Tables\Actions\EditAction::make(),
243 244
                 Tables\Actions\DeleteAction::make(),
244
-                \Filament\Tables\Actions\Action::make("audit")
245
-                ->label(fn ($record) => match ($record->visible) {
246
-                    0 => '發佈',
247
-                    1 => '下架',
248
-                })
249
-                ->color(fn ($record) => match ($record->visible) {
250
-                    0 => 'warning',
251
-                    1 => 'gray',
252
-                })
253
-                ->icon(fn ($record) => match ($record->visible) {
254
-                    0 => 'heroicon-m-chevron-double-up',
255
-                    1 => 'heroicon-m-chevron-double-down',
256
-                })
257
-                ->action(function ($record): void {
258
-                    $record->visible = !$record->visible;
259
-                    $record->save();
260
-                })
261
-                ->outlined()
262
-                ->requiresConfirmation(),
245
+                \Filament\Tables\Actions\Action::make('audit')
246
+                    ->label(fn($record) => match ($record->visible) {
247
+                        0 => '發佈',
248
+                        1 => '下架',
249
+                    })
250
+                    ->color(fn($record) => match ($record->visible) {
251
+                        0 => 'warning',
252
+                        1 => 'gray',
253
+                    })
254
+                    ->icon(fn($record) => match ($record->visible) {
255
+                        0 => 'heroicon-m-chevron-double-up',
256
+                        1 => 'heroicon-m-chevron-double-down',
257
+                    })
258
+                    ->action(function ($record): void {
259
+                        $record->visible = !$record->visible;
260
+                        $record->save();
261
+                    })
262
+                    ->outlined()
263
+                    ->requiresConfirmation(),
263 264
             ])
264 265
             ->bulkActions([
265 266
                 Tables\Actions\BulkActionGroup::make([

+ 29
- 28
app/Filament/Resources/ProfilePartResource.php Целия файл

@@ -2,11 +2,9 @@
2 2
 
3 3
 namespace App\Filament\Resources;
4 4
 
5
-use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
6 5
 use App\Filament\Resources\ProfilePartResource\Pages;
7
-use App\Filament\Resources\ProfilePartResource\RelationManagers;
8 6
 use App\Models\ProfilePart;
9
-use Filament\Forms;
7
+use App\Service\DeepLService;
10 8
 use Filament\Forms\Components\FileUpload;
11 9
 use Filament\Forms\Components\Group;
12 10
 use Filament\Forms\Components\Section;
@@ -18,18 +16,20 @@ use Filament\Tables;
18 16
 use Filament\Tables\Columns\ImageColumn;
19 17
 use Filament\Tables\Columns\TextColumn;
20 18
 use Filament\Tables\Table;
21
-use Illuminate\Database\Eloquent\Builder;
22 19
 use SolutionForest\FilamentTranslateField\Forms\Component\Translate;
23
-use App\Service\DeepLService;
24 20
 
25 21
 class ProfilePartResource extends Resource
26 22
 {
27 23
     protected static ?string $model = ProfilePart::class;
28 24
 
29 25
     protected static ?string $navigationIcon = 'heroicon-o-document';
30
-    protected static ?string $navigationLabel = "宏匯簡介管理";
26
+
27
+    protected static ?string $navigationLabel = '宏匯簡介管理';
28
+
31 29
     protected static ?string $navigationGroup = '關於宏匯';
32
-    protected static ?string $modelLabel = "宏匯簡介管理";
30
+
31
+    protected static ?string $modelLabel = '宏匯簡介管理';
32
+
33 33
     protected static ?int $navigationSort = 2;
34 34
 
35 35
     // 預設排序
@@ -44,31 +44,32 @@ class ProfilePartResource extends Resource
44 44
     {
45 45
         return $form
46 46
             ->schema([
47
-                Section::make("")->schema([
47
+                Section::make('')->schema([
48 48
                     Translate::make()->schema(fn (string $locale) => [
49
-                        TextInput::make("title")->label("標題")->columnSpanFull(),
50
-                        Textarea::make("content")->label("內文")->columnSpanFull()
49
+                        TextInput::make('title')->label('標題')->columnSpanFull(),
50
+                        Textarea::make('content')->label('內文')->columnSpanFull(),
51 51
                     ])
52
-                    ->locales(["zh_TW", "en"])
53
-                    ->actions([
54
-                        app(DeepLService::class)->createTranslationAction("Main", ["title", "content"])
55
-                    ])
56
-                    ->id("Main")->columnSpanFull(),
52
+                        ->locales(['zh_TW', 'en'])
53
+                        ->actions([
54
+                            app(DeepLService::class)->createTranslationAction('Main', ['title', 'content']),
55
+                        ])
56
+                        ->id('Main')->columnSpanFull(),
57 57
                     Group::make()->schema([
58
-                        FileUpload::make("img_url")->label("圖片")
59
-                        ->directory("profile-parts")
60
-                        ->columnSpanFull(),
58
+                        FileUpload::make('img_url')->label('圖片')
59
+                            ->directory('profile-parts')
60
+                            ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor()
61
+                            ->columnSpanFull(),
61 62
                         Translate::make()->schema(fn (string $locale) => [
62
-                            TextInput::make("img_alt")->label("圖片註釋")->columnSpanFull()
63
-                        ])
64
-                        ->locales(["zh_TW", "en"])
65
-                        ->actions([
66
-                            app(DeepLService::class)->createTranslationAction("Img", ["img_alt"])
63
+                            TextInput::make('img_alt')->label('圖片註釋')->columnSpanFull(),
67 64
                         ])
68
-                        ->id("Img")
69
-                        ->columnSpanFull(),
65
+                            ->locales(['zh_TW', 'en'])
66
+                            ->actions([
67
+                                app(DeepLService::class)->createTranslationAction('Img', ['img_alt']),
68
+                            ])
69
+                            ->id('Img')
70
+                            ->columnSpanFull(),
70 71
                     ])->columnSpanFull(),
71
-                ])->columns(3)
72
+                ])->columns(3),
72 73
             ]);
73 74
     }
74 75
 
@@ -76,8 +77,8 @@ class ProfilePartResource extends Resource
76 77
     {
77 78
         return $table
78 79
             ->columns([
79
-                TextColumn::make("title")->label("標題"),
80
-                ImageColumn::make("img_url")->alignCenter(),
80
+                TextColumn::make('title')->label('標題'),
81
+                ImageColumn::make('img_url')->alignCenter(),
81 82
             ])
82 83
             ->filters([
83 84
                 //

+ 6
- 3
app/Filament/Resources/ProjectResource.php Целия файл

@@ -64,9 +64,12 @@ class ProjectResource extends Resource
64 64
                         ->relationship('tags', 'name')
65 65
                         ->preload()
66 66
                         ->label('標籤'),
67
-                    FileUpload::make('thumbnail')->label('縮圖')->directory('project')->image()->imageEditor(),
68
-                    FileUpload::make('img_url')->label('圖片')->directory('project')->reorderable()->multiple()->maxFiles(5),
69
-                    FileUpload::make('mobile_img_url')->label('手機版圖片')->directory('project')->reorderable()->multiple()->maxFiles(5),
67
+                    FileUpload::make('thumbnail')->label('縮圖')->directory('project')->image()
68
+                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor(),
69
+                    FileUpload::make('img_url')->label('圖片')->directory('project')->reorderable()
70
+                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor()->multiple()->maxFiles(20),
71
+                    FileUpload::make('mobile_img_url')->label('手機版圖片')->directory('project')->reorderable()
72
+                        ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor()->multiple()->maxFiles(20),
70 73
                     TextInput::make('order')->label('排序')->default('0'),
71 74
                 ]),
72 75
                 Tabs::make()->schema([

+ 14
- 13
app/Filament/Resources/UploadFileResource.php Целия файл

@@ -3,12 +3,10 @@
3 3
 namespace App\Filament\Resources;
4 4
 
5 5
 use App\Filament\Resources\UploadFileResource\Pages;
6
-use App\Filament\Resources\UploadFileResource\RelationManagers;
7 6
 use App\Models\UploadFile;
8 7
 use Filament\Forms\Components\DatePicker;
9 8
 use Filament\Forms\Components\FileUpload;
10 9
 use Filament\Forms\Components\Group;
11
-use Filament\Forms\Components\Hidden;
12 10
 use Filament\Forms\Components\Radio;
13 11
 use Filament\Forms\Components\Section;
14 12
 use Filament\Forms\Components\TextInput;
@@ -23,26 +21,29 @@ class UploadFileResource extends Resource
23 21
     protected static ?string $model = UploadFile::class;
24 22
 
25 23
     protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
24
+
26 25
     protected static ?string $navigationGroup = '其他設定';
27
-    protected static ?string $navigationLabel = "附檔上傳管理";
28
-    protected static ?string $modelLabel = "附檔上傳管理";
26
+
27
+    protected static ?string $navigationLabel = '附檔上傳管理';
28
+
29
+    protected static ?string $modelLabel = '附檔上傳管理';
29 30
 
30 31
     public static function form(Form $form): Form
31 32
     {
32 33
         return $form
33 34
             ->schema([
34 35
                 //
35
-                Section::make("")->schema([
36
+                Section::make('')->schema([
36 37
                     Group::make()->schema([
37
-                        TextInput::make('title')->required()->label("標題"),
38
-                        Radio::make("type")->label("類型")->options([1 => "社會公益"])->default(1),
38
+                        TextInput::make('title')->required()->label('標題'),
39
+                        Radio::make('type')->label('類型')->options([1 => '社會公益'])->default(1),
39 40
                         Group::make()->schema([
40
-                            FileUpload::make("upload_link")->label("上傳檔案")->directory("uploadFiles")->columnSpan(1),
41
+                            FileUpload::make('upload_link')->label('上傳檔案')->directory('uploadFiles')->columnSpan(1),
41 42
                         ])->columnSpanFull(),
42
-                        DatePicker::make("award_date")->label("獲得日期"),
43
-                        TextInput::make('order')->label("排序")->default("0")
43
+                        DatePicker::make('award_date')->label('獲得日期'),
44
+                        TextInput::make('order')->label('排序')->default('0'),
44 45
                     ])->columns(4)->columnSpanFull(),
45
-                ])
46
+                ]),
46 47
             ]);
47 48
     }
48 49
 
@@ -51,8 +52,8 @@ class UploadFileResource extends Resource
51 52
         return $table
52 53
             ->columns([
53 54
                 // TextColumn::make("type_name")->label("類型"),
54
-                TextColumn::make("title")->label("標題"),
55
-                TextColumn::make("award_date")->label("獲得日期")
55
+                TextColumn::make('title')->label('標題'),
56
+                TextColumn::make('award_date')->label('獲得日期'),
56 57
             ])
57 58
             ->filters([
58 59
                 //

+ 0
- 33
app/Models/Album.php Целия файл

@@ -69,37 +69,4 @@ class Album extends Model
69 69
             get: fn ($value) => ($this->attributes["upload_type"] == 2) ? Storage::url($this->attributes["link"]) : $this->attributes["link"],
70 70
         );
71 71
     }
72
-    public function homepageToTop()
73
-    {
74
-        return $this->morphOne(HomepageToTop::class, 'resource');
75
-    }
76
-    protected static function booted()
77
-    {
78
-        static::created(function ($album) {
79
-            if ($album->homepage_top) {
80
-                $album->createOrUpdatePageSet();
81
-            }
82
-        });
83
-
84
-        static::updated(function ($album) {
85
-            if ($album->isDirty('homepage_top')) {
86
-                if ($album->homepage_top) {
87
-                    $album->createOrUpdatePageSet();
88
-                } else {
89
-                    $album->homepageToTop()->delete();
90
-                }
91
-            }
92
-        });
93
-        static::deleted(function ($album) {
94
-                $album->homepageToTop()->delete();
95
-        });
96
-    }
97
-
98
-    protected function createOrUpdatePageSet()
99
-    {
100
-        $this->homepageToTop()->updateOrCreate(
101
-            [],
102
-            ['resource' => 'video']
103
-        );
104
-    }
105 72
 }

+ 1
- 0
composer.json Целия файл

@@ -8,6 +8,7 @@
8 8
     "require": {
9 9
         "php": "^8.2",
10 10
         "abdulmajeed-jamaan/filament-translatable-tabs": "^3.0",
11
+        "azure-oss/storage-blob-laravel": "^1.4",
11 12
         "bezhansalleh/filament-shield": "^3.3",
12 13
         "deeplcom/deepl-php": "^1.12",
13 14
         "filament/filament": "^3.3",

+ 249
- 1
composer.lock Целия файл

@@ -4,7 +4,7 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "44b40d372827055e89cb5b1d76a38986",
7
+    "content-hash": "0217f8c486e15b4b4c89da20e85b6673",
8 8
     "packages": [
9 9
         {
10 10
             "name": "abdulmajeed-jamaan/filament-translatable-tabs",
@@ -150,6 +150,181 @@
150 150
             "time": "2025-07-30T15:45:57+00:00"
151 151
         },
152 152
         {
153
+            "name": "azure-oss/storage",
154
+            "version": "1.6.0",
155
+            "source": {
156
+                "type": "git",
157
+                "url": "https://github.com/Azure-OSS/azure-storage-php.git",
158
+                "reference": "1962b36c5f65b0032eb8fd69aed6754506ff4773"
159
+            },
160
+            "dist": {
161
+                "type": "zip",
162
+                "url": "https://api.github.com/repos/Azure-OSS/azure-storage-php/zipball/1962b36c5f65b0032eb8fd69aed6754506ff4773",
163
+                "reference": "1962b36c5f65b0032eb8fd69aed6754506ff4773",
164
+                "shasum": ""
165
+            },
166
+            "require": {
167
+                "caseyamcl/guzzle_retry_middleware": "^2.10",
168
+                "ext-curl": "*",
169
+                "ext-json": "*",
170
+                "ext-simplexml": "*",
171
+                "guzzlehttp/guzzle": "^7.8",
172
+                "php": "^8.1"
173
+            },
174
+            "require-dev": {
175
+                "ext-zlib": "*",
176
+                "guzzlehttp/test-server": "^0.1.0",
177
+                "laravel/pint": "1.20.0",
178
+                "phpbench/phpbench": "^1.3",
179
+                "phpstan/phpstan": "^2.1",
180
+                "phpstan/phpstan-deprecation-rules": "^2.0",
181
+                "phpstan/phpstan-strict-rules": "^2.0",
182
+                "phpunit/phpunit": "^10.5"
183
+            },
184
+            "type": "library",
185
+            "autoload": {
186
+                "psr-4": {
187
+                    "AzureOss\\Storage\\": "src/"
188
+                }
189
+            },
190
+            "notification-url": "https://packagist.org/downloads/",
191
+            "license": [
192
+                "MIT"
193
+            ],
194
+            "authors": [
195
+                {
196
+                    "name": "Brecht Vermeersch",
197
+                    "email": "brechtvermeersch@outlook.be"
198
+                },
199
+                {
200
+                    "name": "Pim Jansen",
201
+                    "email": "pimjansen@gmail.com"
202
+                }
203
+            ],
204
+            "description": "Azure Storage PHP SDK",
205
+            "keywords": [
206
+                "azure",
207
+                "php",
208
+                "sdk",
209
+                "storage"
210
+            ],
211
+            "support": {
212
+                "issues": "https://github.com/Azure-OSS/azure-storage-php/issues",
213
+                "source": "https://github.com/Azure-OSS/azure-storage-php/tree/1.6.0"
214
+            },
215
+            "time": "2025-11-17T11:32:51+00:00"
216
+        },
217
+        {
218
+            "name": "azure-oss/storage-blob-flysystem",
219
+            "version": "1.3.0",
220
+            "source": {
221
+                "type": "git",
222
+                "url": "https://github.com/Azure-OSS/azure-storage-php-adapter-flysystem.git",
223
+                "reference": "45636fd054fad2b6202ca125fb655e1df1e79405"
224
+            },
225
+            "dist": {
226
+                "type": "zip",
227
+                "url": "https://api.github.com/repos/Azure-OSS/azure-storage-php-adapter-flysystem/zipball/45636fd054fad2b6202ca125fb655e1df1e79405",
228
+                "reference": "45636fd054fad2b6202ca125fb655e1df1e79405",
229
+                "shasum": ""
230
+            },
231
+            "require": {
232
+                "azure-oss/storage": "^1.4",
233
+                "league/flysystem": "^3.28",
234
+                "php": "^8.1"
235
+            },
236
+            "require-dev": {
237
+                "laravel/pint": "^1.16",
238
+                "league/flysystem-adapter-test-utilities": "^3.28",
239
+                "phpstan/phpstan": "^1.11",
240
+                "phpunit/phpunit": "^10.5",
241
+                "rector/rector": "^1.2"
242
+            },
243
+            "type": "library",
244
+            "autoload": {
245
+                "psr-4": {
246
+                    "AzureOss\\FlysystemAzureBlobStorage\\": "src/"
247
+                }
248
+            },
249
+            "notification-url": "https://packagist.org/downloads/",
250
+            "license": [
251
+                "MIT"
252
+            ],
253
+            "authors": [
254
+                {
255
+                    "name": "Brecht Vermeersch",
256
+                    "email": "brechtvermeersch@outlook.be"
257
+                },
258
+                {
259
+                    "name": "Pim Jansen",
260
+                    "email": "pimjansen@gmail.com"
261
+                }
262
+            ],
263
+            "description": "Flysystem adapter for Azure Storage PHP",
264
+            "support": {
265
+                "issues": "https://github.com/Azure-OSS/azure-storage-php-adapter-flysystem/issues",
266
+                "source": "https://github.com/Azure-OSS/azure-storage-php-adapter-flysystem/tree/1.3.0"
267
+            },
268
+            "time": "2025-10-03T16:26:33+00:00"
269
+        },
270
+        {
271
+            "name": "azure-oss/storage-blob-laravel",
272
+            "version": "1.4.0",
273
+            "source": {
274
+                "type": "git",
275
+                "url": "https://github.com/Azure-OSS/azure-storage-php-adapter-laravel.git",
276
+                "reference": "2da197581db2a0f76475f5b34e5997bb51f0a7a1"
277
+            },
278
+            "dist": {
279
+                "type": "zip",
280
+                "url": "https://api.github.com/repos/Azure-OSS/azure-storage-php-adapter-laravel/zipball/2da197581db2a0f76475f5b34e5997bb51f0a7a1",
281
+                "reference": "2da197581db2a0f76475f5b34e5997bb51f0a7a1",
282
+                "shasum": ""
283
+            },
284
+            "require": {
285
+                "azure-oss/storage-blob-flysystem": "^1.2",
286
+                "illuminate/filesystem": "^10|^11|^12",
287
+                "illuminate/support": "^10|^11|^12",
288
+                "php": "^8.1"
289
+            },
290
+            "require-dev": {
291
+                "laravel/pint": "^1.17",
292
+                "orchestra/testbench": "^8.27",
293
+                "phpstan/phpstan": "^1.11",
294
+                "phpstan/phpstan-deprecation-rules": "^1.2",
295
+                "phpstan/phpstan-strict-rules": "^1.6"
296
+            },
297
+            "type": "library",
298
+            "extra": {
299
+                "laravel": {
300
+                    "providers": [
301
+                        "AzureOss\\LaravelAzureStorageBlob\\AzureStorageBlobServiceProvider"
302
+                    ]
303
+                }
304
+            },
305
+            "autoload": {
306
+                "psr-4": {
307
+                    "AzureOss\\LaravelAzureStorageBlob\\": "src/"
308
+                }
309
+            },
310
+            "notification-url": "https://packagist.org/downloads/",
311
+            "license": [
312
+                "MIT"
313
+            ],
314
+            "authors": [
315
+                {
316
+                    "name": "Brecht Vermeersch",
317
+                    "email": "brechtvermeersch@outlook.be"
318
+                }
319
+            ],
320
+            "description": "Azure Storage Blob filesystem driver for Laravel",
321
+            "support": {
322
+                "issues": "https://github.com/Azure-OSS/azure-storage-php-adapter-laravel/issues",
323
+                "source": "https://github.com/Azure-OSS/azure-storage-php-adapter-laravel/tree/1.4.0"
324
+            },
325
+            "time": "2025-08-12T07:36:24+00:00"
326
+        },
327
+        {
153 328
             "name": "bezhansalleh/filament-shield",
154 329
             "version": "3.3.9",
155 330
             "source": {
@@ -516,6 +691,79 @@
516 691
             "time": "2024-02-09T16:56:22+00:00"
517 692
         },
518 693
         {
694
+            "name": "caseyamcl/guzzle_retry_middleware",
695
+            "version": "v2.13.0",
696
+            "source": {
697
+                "type": "git",
698
+                "url": "https://github.com/caseyamcl/guzzle_retry_middleware.git",
699
+                "reference": "17c9299cde438b00bbeb099c6480319a81636a60"
700
+            },
701
+            "dist": {
702
+                "type": "zip",
703
+                "url": "https://api.github.com/repos/caseyamcl/guzzle_retry_middleware/zipball/17c9299cde438b00bbeb099c6480319a81636a60",
704
+                "reference": "17c9299cde438b00bbeb099c6480319a81636a60",
705
+                "shasum": ""
706
+            },
707
+            "require": {
708
+                "guzzlehttp/guzzle": "^6.3|^7.0",
709
+                "php": "^7.1|^8.0"
710
+            },
711
+            "require-dev": {
712
+                "jaschilz/php-coverage-badger": "^2.0",
713
+                "nesbot/carbon": "^2.0|^3.0",
714
+                "phpstan/extension-installer": "^1.0",
715
+                "phpstan/phpstan": "^1.0",
716
+                "phpunit/phpunit": "^7.5|^8.0|^9.0",
717
+                "squizlabs/php_codesniffer": "^3.5",
718
+                "symfony/var-dumper": "^5.0|^6.0|^7.0"
719
+            },
720
+            "type": "library",
721
+            "extra": {
722
+                "branch-alias": {
723
+                    "dev-master": "2.0-dev"
724
+                }
725
+            },
726
+            "autoload": {
727
+                "psr-4": {
728
+                    "GuzzleRetry\\": "src"
729
+                }
730
+            },
731
+            "notification-url": "https://packagist.org/downloads/",
732
+            "license": [
733
+                "MIT"
734
+            ],
735
+            "authors": [
736
+                {
737
+                    "name": "Casey McLaughlin",
738
+                    "email": "caseyamcl@gmail.com",
739
+                    "homepage": "https://caseymclaughlin.com",
740
+                    "role": "Developer"
741
+                }
742
+            ],
743
+            "description": "Guzzle v6+ retry middleware that handles 429/503 status codes and connection timeouts",
744
+            "homepage": "https://github.com/caseyamcl/guzzle_retry_middleware",
745
+            "keywords": [
746
+                "Guzzle",
747
+                "back-off",
748
+                "caseyamcl",
749
+                "guzzle_retry_middleware",
750
+                "middleware",
751
+                "retry",
752
+                "retry-after"
753
+            ],
754
+            "support": {
755
+                "issues": "https://github.com/caseyamcl/guzzle_retry_middleware/issues",
756
+                "source": "https://github.com/caseyamcl/guzzle_retry_middleware/tree/v2.13.0"
757
+            },
758
+            "funding": [
759
+                {
760
+                    "url": "https://github.com/caseyamcl",
761
+                    "type": "github"
762
+                }
763
+            ],
764
+            "time": "2025-07-11T12:33:22+00:00"
765
+        },
766
+        {
519 767
             "name": "danharrin/date-format-converter",
520 768
             "version": "v0.3.1",
521 769
             "source": {

+ 5
- 0
config/filesystems.php Целия файл

@@ -29,6 +29,11 @@ return [
29 29
     */
30 30
 
31 31
     'disks' => [
32
+        'azure' => [
33
+            'driver' => 'azure-storage-blob',
34
+            'connection_string' => env('AZURE_STORAGE_CONNECTION_STRING'),
35
+            'container' => env('AZURE_STORAGE_CONTAINER'),
36
+        ],
32 37
 
33 38
         'local' => [
34 39
             'driver' => 'local',