diff --git a/src/Resources/MediaResource.php b/src/Resources/MediaResource.php index 57a1d19..fa53f39 100644 --- a/src/Resources/MediaResource.php +++ b/src/Resources/MediaResource.php @@ -85,14 +85,14 @@ public static function form(Form $form): Form { return $form ->schema([ - Section::make('Media Details') + Section::make('') ->columns(2) ->schema([ FileUpload::make('media') ->label(__('File(s)')) ->disk(config('media-picker.disk')) ->directory(config('media-picker.directory')) - ->shouldPreserveFilename(config('media-picker.should_preserve_filenames')) + ->preserveFilenames(config('media-picker.should_preserve_filenames')) ->visibility(config('media-picker.visibility')) ->acceptedFileTypes(config('media-picker.accepted_file_types')) ->required() @@ -102,11 +102,11 @@ public static function form(Form $form): Form ->label(__('Model Type')) ->options(function () { return collect(config('media-picker.file_upload.models')) - ->mapWithKeys(fn($model) => [$model => $model::getLabel()]) + ->mapWithKeys(fn($model) => [$model => class_basename($model)]) ->toArray(); }) ->columnSpan(1) - ->live(), // Add live() to make it reactive + ->live(), Select::make('model_id') ->label(__('Model')) @@ -120,7 +120,7 @@ public static function form(Form $form): Form return $selectedModelType::all()->pluck('name', 'id'); }) ->columnSpan(1) - ->disabled(fn(Get $get) => ! $get('model_type')), // Disable until model type is selected + ->disabled(fn(Get $get) => ! $get('model_type')), ]), ]); }