定制 oriondevelops/filament-backup 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

oriondevelops/filament-backup

最新稳定版本:v1.0.2

Composer 安装命令:

composer require oriondevelops/filament-backup

包简介

A Filament plugin to backup your app.

README 文档

README

Latest Version on Packagist Total Downloads

This Filament plugin is a dedicated port of the spatie/nova-backup-tool, adapted to work seamlessly with Filament.

Much of the underlying codebase and functionality owe their origins to the work done by the contributors on the original Nova tool. This adaptation was undertaken with deep respect and acknowledgment of their effort.

The plugin lets you:

  • List all backups
  • Create a new backup
  • Download a backup
  • Delete a backup

Internally, it utilizes spatie/laravel-backup to manage these backups.

screenshot

Requirements

Ensure that you meet the requirements for spatie/laravel-backup.

Installation

Install spatie/laravel-backup into your Laravel app following its installation instructions.

You can install the package via composer:

composer require oriondevelops/filament-backup

Next you should setup a queue. Any driver is fine except the sync driver.

Usage

You need to register the plugin with your preferred Filament panel providers. This can be done inside of your PanelProvider, e.g. AdminPanelProvider.

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentBackup\BackupPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(BackupPlugin::make());
    }
}

You can now click on the "Backups" menu item in your Filament app to see the backup plugin.

Customizing visibility, download and delete permissions

Define who can view, download, or delete backups. Tailor access based on user permissions.

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentBackup\BackupPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(
                BackupPlugin::make()
                    ->visible(fn() => auth()->user()->can('view backups'))
                    ->downloadable(fn() => auth()->user()->can('download backups'))
                    ->deletable(fn() => auth()->user()->can('delete backups')),
            );
    }
}

Customizing the navigation item

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentBackup\BackupPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(
                BackupPlugin::make()
                    ->slug('my-precious-backups')
                    ->label('Backups')
                    ->icon('heroicon-o-server-stack')
                    ->group('System')
                    ->sort(3),
            );
    }
}

Customizing the polling interval

You can customise the polling interval or disable polling:

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentBackup\BackupPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(
                BackupPlugin::make()
                    ->polling(enabled: true, interval: '10s'),
            );
    }
}

Customizing the backup queue and page

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentBackup\BackupPlugin;
use App\Filament\Pages\ExtendedBackupsPage;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(
                BackupPlugin::make()
                    ->queue('custom-queue')
                    ->page(ExtendedBackupsPage::class),
            );
    }
}

Contributing

Please see CONTRIBUTING for details.

Security

Please review Security Policy on how to report security vulnerabilities.

Nova Backup Tool Credits

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 216
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-26