Skip to content

Backup using Spatie Multitenant Package #1502

Answered by sys-auditing
sys-auditing asked this question in Q&A
Discussion options

You must be logged in to vote

I have just fixed the issue.

Create Task file, in order to change backup databases & dilename_prefix parameter on-the-fly.

\\SwitchBackupDatabaseTask.php

<?php

namespace App\Tasks;

use Illuminate\Support\Str;
use Spatie\Multitenancy\Models\Tenant;
use Spatie\Multitenancy\Tasks\SwitchTenantTask;

class SwitchBackupDatabaseTask implements SwitchTenantTask
{
    public function __construct(protected ?array $originalBackupDatabase= null, protected ?string $originalBackupFilenamePrefix= null)
    {
        $this->originalBackupDatabase??= config('backup.backup.source.databases');
        $this->originalBackupFilenamePrefix??= config('backup.backup.destination.filename_prefix');
    }
    
    

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@padalton
Comment options

@juukie
Comment options

Answer selected by sys-auditing
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants