PHP code example of microcode / filament-database-backup

1. Go to this page and download the library: Download microcode/filament-database-backup library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

microcode / filament-database-backup example snippets


use Microcode\FilamentDatabaseBackup\FilamentDatabaseBackupPlugin;
use Microcode\FilamentIntegrations\IntegrationsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(
            IntegrationsPlugin::make()
                ->navigationGroup('Settings')
                ->canAccessSettings(fn (): bool => true)
                ->only(['aws'])
        )
        ->plugin(
            FilamentDatabaseBackupPlugin::make()
                ->authorize(fn (): bool => auth()->user()?->can('manage-backups') ?? false)
                ->navigationGroup('Settings')
                ->navigationSort(30)
                ->retentionDays(30)
                // ->cluster(SomeCluster::class)
                // ->queue('backups')
        );
}

'backups' => [
    'driver' => 'local',
    'root' => storage_path('app/backups'),
    'visibility' => 'private',
    'throw' => false,
],

FilamentDatabaseBackupPlugin::make()->retentionDays(30)

use Illuminate\Support\Facades\Schedule;

Schedule::command('database-backup:run-scheduled')->everyMinute();
bash
composer vendor:publish --tag="filament-database-backup-config"
php artisan vendor:publish --tag="filament-database-backup-migrations"
php artisan migrate
bash
php artisan queue:work --queue=backups --tries=1 --timeout=600