15
15
use Statikbe \FilamentFlexibleBlocksAssetManager \Filament \Resources \AssetResource \Pages \EditAsset ;
16
16
use Statikbe \FilamentFlexibleBlocksAssetManager \Filament \Resources \AssetResource \Pages \ListAssets ;
17
17
use Statikbe \FilamentFlexibleBlocksAssetManager \FilamentFlexibleBlocksAssetManagerConfig ;
18
- use Statikbe \FilamentFlexibleBlocksAssetManager \Models \Asset ;
19
18
20
19
class AssetResource extends Resource
21
20
{
22
21
use Translatable;
23
22
24
- protected static ?string $ model = Asset::class;
25
-
26
23
protected static ?string $ navigationIcon = 'heroicon-o-photo ' ;
27
24
25
+ protected static ?string $ recordTitleAttribute = 'name ' ;
26
+
28
27
public static function getNavigationLabel (): string
29
28
{
30
29
return trans ('filament-flexible-blocks-asset-manager::filament-flexible-blocks-asset-manager.asset_nav_lbl ' );
@@ -40,20 +39,33 @@ public static function getPluralLabel(): string
40
39
return trans ('filament-flexible-blocks-asset-manager::filament-flexible-blocks-asset-manager.asset_plural_lbl ' );
41
40
}
42
41
42
+ public static function getModel (): string
43
+ {
44
+ return FilamentFlexibleBlocksAssetManagerConfig::getModel ();
45
+ }
46
+
43
47
public static function getNavigationGroup (): ?string
44
48
{
45
49
return FilamentFlexibleBlocksAssetManagerConfig::getNavigationGroup ();
46
50
}
47
51
52
+ public static function getDefaultComponents (): array
53
+ {
54
+ return [
55
+ AssetNameField::create (true ),
56
+ AssetMediaField::create (FilamentFlexibleBlocksAssetManagerConfig::hasTranslatableAssets ())
57
+ ->required (),
58
+ ];
59
+ }
60
+
48
61
public static function form (Form $ form ): Form
49
62
{
50
63
return $ form
51
64
->schema ([
52
65
Section::make ()
53
66
->columns (2 )
54
67
->schema ([
55
- AssetNameField::create (true ),
56
- AssetMediaField::create (FilamentFlexibleBlocksAssetManagerConfig::hasTranslatableAssets ()),
68
+ ...static ::getDefaultComponents (),
57
69
]),
58
70
]);
59
71
}
0 commit comments