webteractive/filament-google-drive-backup-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

webteractive/filament-google-drive-backup-manager

最新稳定版本:v0.1.2

Composer 安装命令:

composer require webteractive/filament-google-drive-backup-manager

包简介

A Filament plugin for managing Google Drive backups in Laravel

README 文档

README

Latest Version on Packagist Total Downloads

A Filament plugin for managing Spatie Laravel Backup files stored on Google Drive. View, download, delete, and trigger backups directly from your Filament admin panel.

Requirements

Installation

composer require webteractive/filament-google-drive-backup-manager

Publish the config file:

php artisan vendor:publish --tag="google-drive-backup-manager-config"

Google Drive Setup

Add your Google OAuth credentials to the published config file (config/google-drive-backup-manager.php):

'google' => [
    'client_id' => env('GOOGLE_DRIVE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
    'redirect' => env('GOOGLE_DRIVE_REDIRECT_URI'),
],

Then add a google disk to your config/filesystems.php:

'disks' => [
    'google' => [
        'driver' => 'google',
        'folder' => env('GOOGLE_DRIVE_FOLDER', '/'),
    ],
],

Add the corresponding values to your .env file:

GOOGLE_DRIVE_CLIENT_ID=your-client-id
GOOGLE_DRIVE_CLIENT_SECRET=your-client-secret
GOOGLE_DRIVE_REDIRECT_URI=https://yourapp.com/google-drive-backup-manager-oauth/callback
GOOGLE_DRIVE_FOLDER=/

The refresh token is automatically resolved from the user who connected their Google account via the admin panel. No manual token configuration needed.

Filament Panel Registration

Register the plugin in your Filament panel provider:

use Webteractive\GoogleDriveBackupManager\GoogleDriveBackupManagerPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            GoogleDriveBackupManagerPlugin::make(),
        ]);
}

Authorization

Access to the backup manager is controlled by a Laravel Gate. By default, the gate name is viewBackups. Define it in your AppServiceProvider:

use Illuminate\Support\Facades\Gate;

Gate::define('viewBackups', function ($user) {
    return $user->is_admin;
});

You can change the gate name in the config:

'gate' => 'yourCustomGate',

Configuration

All settings are in config/google-drive-backup-manager.php:

return [
    // Storage disk name (must match a disk in config/filesystems.php)
    'disk' => 'google',

    // Laravel Gate for authorization
    'gate' => 'viewBackups',

    // Filament sidebar navigation group
    'navigation_group' => 'System',

    // Sidebar sort order
    'navigation_sort' => 5,

    // Named route for downloading backups
    'download_route' => 'backup.download',

    // Column on users table for storing Google OAuth tokens
    'google_token_column' => 'google_backup',

    // Queue name for backup jobs (null = default queue)
    'queue' => null,

    // Google OAuth credentials (kept within this package's config)
    'google' => [
        'client_id' => env('GOOGLE_DRIVE_CLIENT_ID'),
        'client_secret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
        'redirect' => env('GOOGLE_DRIVE_REDIRECT_URI'),
    ],

    // Route middleware
    'middleware' => ['web', 'auth'],

    // Base path for OAuth routes
    'oauth_base_path' => 'google-drive-backup-manager-oauth',

];

Scheduling Backups

This plugin provides an on-demand UI for triggering backups, but does not schedule them automatically. To run backups on a schedule, add the Spatie backup commands to your application's routes/console.php:

use Illuminate\Support\Facades\Schedule;

Schedule::command('backup:run')->daily()->at('02:00');
Schedule::command('backup:clean')->daily()->at('03:00');

Refer to the Spatie Laravel Backup docs for scheduling options, notification setup, cleanup strategies, and other configuration.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固