icon(__('filament.table_actions.base.upload.icon')); } /** * Get the fields available on the action. * * @param Form $form * @return Form * * @noinspection PhpMissingParentCallCommonInspection */ public function getForm(Form $form): Form { $fs = Storage::disk($this->disk()); return $form->schema([ FileUpload::make('file') ->label(__('filament.actions.storage.upload.fields.file.name')) ->helperText(__('filament.actions.storage.upload.fields.file.help')) ->required() ->live(true) ->rules($this->fileRules()) ->preserveFilenames() ->storeFiles(false), TextInput::make('path') ->label(__('filament.actions.storage.upload.fields.path.name')) ->helperText(__('filament.actions.storage.upload.fields.path.help')) ->rules(['doesnt_start_with:/', 'doesnt_end_with:/', 'string', new StorageDirectoryExistsRule($fs)]), ]); } /** * Get the underlying storage action. * * @param array $fields * @return BaseUploadAction */ abstract protected function storageAction(array $fields): BaseUploadAction; /** * Get the file validation rules. * * @return array */ abstract protected function fileRules(): array; }