We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thanks to @Thijmen
We need to add this to the documentation.
<?php namespace App\Console\Commands; use Hyn\Tenancy\Database\Connection; use Hyn\Tenancy\Models\Website; use Illuminate\Console\Command; class BackupCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'app:backup'; /** * The console command description. * * @var string */ protected $description = 'Backup all the tenants and system'; /** * Execute the console command. * * @return mixed */ public function handle() { $this->backupSystem(); $sites = Website::all(); foreach ($sites as $site) { $this->setupConfigForSite($site); $this->callBackupCommand(); }; } protected function backupSystem() { \Config::set('backup.backup.source.databases', ['system']); \Config::set('backup.backup.name', 'system-backup'); $this->call('backup:run', ['--only-db']); } protected function setupConfigForSite(Website $website) { $connection = app(Connection::class); $connection->set($website); \Config::set('backup.backup.source.databases', ['tenant']); \Config::set('backup.backup.name', 'tenant-' . $website->uuid); \Config::set('backup.backup.source.files.include', $this->siteIncludes($website)); } protected function siteIncludes(Website $website) { return storage_path('app/tenancy/tenants/' . $website->uuid); } protected function callBackupCommand() { $this->call('backup:run'); } }
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
bkintanar
No branches or pull requests
Thanks to @Thijmen
We need to add this to the documentation.
The text was updated successfully, but these errors were encountered: