components([ TextInput::make('package_name')->label(__('plugin.labels.package_name')), TextInput::make('remote_url')->label(__('plugin.labels.remote_url')), ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('id'), TextColumn::make('package_name')->label(__('plugin.labels.package_name')), TextColumn::make('remote_url')->label(__('plugin.labels.remote_url')), TextColumn::make('installed_version')->label(__('plugin.labels.installed_version')), TextColumn::make('statusText')->label(__('label.status')), TextColumn::make('updated_at')->label(__('plugin.labels.updated_at')), ]) ->filters([ // ]) ->recordActions(self::getActions()) ->toolbarActions([ DeleteBulkAction::make(), ]); } public static function getPages(): array { return [ 'index' => ManagePlugins::route('/'), ]; } private static function getActions() { $actions = []; $actions[] = EditAction::make(); $actions[] = self::buildInstallAction(); $actions[] = self::buildUpdateAction(); $actions[] = DeleteAction::make('delete') ->hidden(fn ($record) => !in_array($record->status, Plugin::$showDeleteBtnStatus)) ->using(function ($record) { $record->update(['status' => Plugin::STATUS_PRE_DELETE]); ManagePlugin::dispatch($record, 'delete'); }); return $actions; } private static function buildInstallAction() { return Action::make('install') ->label(__('plugin.actions.install')) ->icon('heroicon-o-arrow-down') ->requiresConfirmation() ->hidden(fn ($record) => !in_array($record->status, Plugin::$showInstallBtnStatus)) ->action(function ($record) { $record->update(['status' => Plugin::STATUS_PRE_INSTALL]); ManagePlugin::dispatch($record, 'install'); }) ; } private static function buildUpdateAction() { return Action::make('update') ->label(__('plugin.actions.update')) ->icon('heroicon-o-arrow-up') ->requiresConfirmation() ->hidden(fn ($record) => !in_array($record->status, Plugin::$showUpdateBtnStatus)) ->action(function ($record) { $record->update(['status' => Plugin::STATUS_PRE_UPDATE]); ManagePlugin::dispatch($record, 'update'); }) ; } }