This commit is contained in:
Bozhidar 2024-05-01 01:06:11 +03:00
parent d25cff070d
commit 7eb9c3e624
2 changed files with 19 additions and 0 deletions

View file

@ -100,6 +100,11 @@ class HostingSubscription extends Model
return $this->hasMany(HostingSubscriptionBackup::class);
}
public function domain()
{
return $this->hasMany(Domain::class);
}
private function _createLinuxWebUser($model): array
{
$findCustomer = Customer::where('id', $model->customer_id)->first();

View file

@ -11,6 +11,8 @@ use App\Listeners\ModelDomainDeletingListener;
use App\Listeners\ModelHostingSubscriptionCreatingListener;
use App\Listeners\ModelHostingSubscriptionDeletingListener;
use App\Livewire\Components\QuickServiceRestartMenu;
use App\Models\Domain;
use App\Models\HostingSubscription;
use App\Policies\CustomerPolicy;
use BladeUI\Icons\Factory;
use Filament\Facades\Filament;
@ -20,6 +22,7 @@ use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Livewire\Livewire;
class AppServiceProvider extends ServiceProvider
@ -69,5 +72,16 @@ class AppServiceProvider extends ServiceProvider
Gate::define('delete-customer', [CustomerPolicy::class, 'delete']);
if (is_file(storage_path('installed'))) {
$getDomains = Domain::all();
if ($getDomains->count() > 0) {
foreach ($getDomains as $domain) {
$this->app['config']["filesystems.disks.backups_" . Str::slug($domain->domain)] = [
'driver' => 'local',
'root' => $domain->domain_root . '/backups',
];
}
}
}
}
}