update
This commit is contained in:
parent
000a0db564
commit
67cd7ec58b
103 changed files with 383 additions and 517 deletions
|
@ -5,7 +5,6 @@ namespace Modules\LetsEncrypt\App\Http\Controllers;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
|
||||||
|
|
||||||
class LetsEncryptController extends Controller
|
class LetsEncryptController extends Controller
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ class LetsEncryptServiceProvider extends ServiceProvider
|
||||||
$this->registerViews();
|
$this->registerViews();
|
||||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
||||||
|
|
||||||
// Event::listen(HostingAccountIsCreated::class,HostingAccountIsCreatedListener::class);
|
// Event::listen(HostingAccountIsCreated::class,HostingAccountIsCreatedListener::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,6 @@ class LetsEncryptServiceProvider extends ServiceProvider
|
||||||
$this->app->register(RouteServiceProvider::class);
|
$this->app->register(RouteServiceProvider::class);
|
||||||
$this->app->register(AdminPanelProvider::class);
|
$this->app->register(AdminPanelProvider::class);
|
||||||
|
|
||||||
|
|
||||||
app()->virtualHostManager->registerConfig(LetsEncryptApacheVirtualHostConfig::class, $this->moduleNameLower);
|
app()->virtualHostManager->registerConfig(LetsEncryptApacheVirtualHostConfig::class, $this->moduleNameLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace Modules\LetsEncrypt\App\Providers;
|
namespace Modules\LetsEncrypt\App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,6 @@ use App\VirtualHosts\ApacheVirtualHostConfigBase;
|
||||||
class LetsEncryptApacheVirtualHostConfig extends ApacheVirtualHostConfigBase
|
class LetsEncryptApacheVirtualHostConfig extends ApacheVirtualHostConfigBase
|
||||||
{
|
{
|
||||||
public array $phpAdminValueOpenBaseDirs = [
|
public array $phpAdminValueOpenBaseDirs = [
|
||||||
'/usr/share/letsencrypt'
|
'/usr/share/letsencrypt',
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ use App\Actions\ApacheWebsiteApplySSLVirtualHost;
|
||||||
use App\ApiClient;
|
use App\ApiClient;
|
||||||
use App\Events\HostingAccountIsCreated;
|
use App\Events\HostingAccountIsCreated;
|
||||||
use App\FileManagerApi;
|
use App\FileManagerApi;
|
||||||
use App\Models\HostingPlan;
|
|
||||||
use App\Models\DomainSslCertificate;
|
use App\Models\DomainSslCertificate;
|
||||||
|
use App\Models\HostingPlan;
|
||||||
use App\Settings;
|
use App\Settings;
|
||||||
use App\ShellApi;
|
use App\ShellApi;
|
||||||
|
|
||||||
|
@ -27,16 +27,16 @@ class HostingAccountIsCreatedListener
|
||||||
public function handle(HostingAccountIsCreated $event): void
|
public function handle(HostingAccountIsCreated $event): void
|
||||||
{
|
{
|
||||||
$findWebsite = \App\Models\Domain::where('id', $event->model->id)->first();
|
$findWebsite = \App\Models\Domain::where('id', $event->model->id)->first();
|
||||||
if (!$findWebsite) {
|
if (! $findWebsite) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$findHostingPlan = HostingPlan::where('id', $findWebsite->hosting_plan_id)->first();
|
$findHostingPlan = HostingPlan::where('id', $findWebsite->hosting_plan_id)->first();
|
||||||
if (!$findHostingPlan) {
|
if (! $findHostingPlan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array('letsencrypt', $findHostingPlan->additional_services)) {
|
if (! in_array('letsencrypt', $findHostingPlan->additional_services)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ class HostingAccountIsCreatedListener
|
||||||
])->render();
|
])->render();
|
||||||
|
|
||||||
$fmApi = new FileManagerApi();
|
$fmApi = new FileManagerApi();
|
||||||
$fmApi->filePutContents($event->model->domain_root . '/acme-config.yaml', $acmeConfigYaml);
|
$fmApi->filePutContents($event->model->domain_root.'/acme-config.yaml', $acmeConfigYaml);
|
||||||
|
|
||||||
$amePHPPharFile = base_path() . '/Modules/LetsEncrypt/Actions/acmephp.phar';
|
$amePHPPharFile = base_path().'/Modules/LetsEncrypt/Actions/acmephp.phar';
|
||||||
|
|
||||||
$phyrePHP = ApiClient::getPhyrePHP();
|
$phyrePHP = ApiClient::getPhyrePHP();
|
||||||
|
|
||||||
$command = $phyrePHP . ' ' . $amePHPPharFile . ' run ' . $event->model->domain_root . '/acme-config.yaml';
|
$command = $phyrePHP.' '.$amePHPPharFile.' run '.$event->model->domain_root.'/acme-config.yaml';
|
||||||
ShellApi::exec($command);
|
ShellApi::exec($command);
|
||||||
|
|
||||||
$validateCertificates = [];
|
$validateCertificates = [];
|
||||||
|
@ -71,13 +71,13 @@ class HostingAccountIsCreatedListener
|
||||||
$sslCertificateKeyFileContent = $fmApi->fileGetContents($sslCertificateKeyFilePath);
|
$sslCertificateKeyFileContent = $fmApi->fileGetContents($sslCertificateKeyFilePath);
|
||||||
$sslCertificateChainFileContent = $fmApi->fileGetContents($sslCertificateChainFilePath);
|
$sslCertificateChainFileContent = $fmApi->fileGetContents($sslCertificateChainFilePath);
|
||||||
|
|
||||||
if (!empty($sslCertificateChainFileContent)) {
|
if (! empty($sslCertificateChainFileContent)) {
|
||||||
$validateCertificates['certificate'] = $sslCertificateFileContent;
|
$validateCertificates['certificate'] = $sslCertificateFileContent;
|
||||||
}
|
}
|
||||||
if (!empty($sslCertificateKeyFileContent)) {
|
if (! empty($sslCertificateKeyFileContent)) {
|
||||||
$validateCertificates['private_key'] = $sslCertificateKeyFileContent;
|
$validateCertificates['private_key'] = $sslCertificateKeyFileContent;
|
||||||
}
|
}
|
||||||
if (!empty($sslCertificateChainFileContent)) {
|
if (! empty($sslCertificateChainFileContent)) {
|
||||||
$validateCertificates['certificate_chain'] = $sslCertificateChainFileContent;
|
$validateCertificates['certificate_chain'] = $sslCertificateChainFileContent;
|
||||||
}
|
}
|
||||||
if (count($validateCertificates) !== 3) {
|
if (count($validateCertificates) !== 3) {
|
||||||
|
@ -106,6 +106,5 @@ class HostingAccountIsCreatedListener
|
||||||
$applySSLVirtualHost->setSslCertificateChainFilePath($sslCertificateChainFilePath);
|
$applySSLVirtualHost->setSslCertificateChainFilePath($sslCertificateChainFilePath);
|
||||||
$applySSLVirtualHost->handle();
|
$applySSLVirtualHost->handle();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,12 @@ use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
|
|
||||||
class AdminPanelProvider extends PanelProvider
|
class AdminPanelProvider extends PanelProvider
|
||||||
{
|
{
|
||||||
private string $module = "LetsEncrypt";
|
private string $module = 'LetsEncrypt';
|
||||||
|
|
||||||
public function panel(Panel $panel): Panel
|
public function panel(Panel $panel): Panel
|
||||||
{
|
{
|
||||||
$moduleNamespace = $this->getModuleNamespace();
|
$moduleNamespace = $this->getModuleNamespace();
|
||||||
|
|
||||||
return $panel
|
return $panel
|
||||||
->id('Lets Encrypt ::admin')
|
->id('Lets Encrypt ::admin')
|
||||||
->path('admin/modules/letsencrypt')
|
->path('admin/modules/letsencrypt')
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Modules\Microweber\App\Http\Controllers;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
|
||||||
|
|
||||||
class MicroweberController extends Controller
|
class MicroweberController extends Controller
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,18 +3,15 @@
|
||||||
namespace Modules\Microweber\App\Models;
|
namespace Modules\Microweber\App\Models;
|
||||||
|
|
||||||
use App\Models\Domain;
|
use App\Models\Domain;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Modules\Microweber\Database\factories\MicroweberInstallationFactory;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class MicroweberInstallation extends Model
|
class MicroweberInstallation extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
public function domain()
|
public function domain()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Domain::class, 'id', 'domain_id');
|
return $this->hasOne(Domain::class, 'id', 'domain_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
|
|
||||||
namespace Modules\Microweber\App\Providers;
|
namespace Modules\Microweber\App\Providers;
|
||||||
|
|
||||||
|
use App\Events\DomainIsCreated;
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use App\Events\DomainIsCreated;
|
|
||||||
use Modules\Microweber\Listeners\DomainIsCreatedListener;
|
use Modules\Microweber\Listeners\DomainIsCreatedListener;
|
||||||
use App\VirtualHosts\ApacheVirtualHostManager;
|
|
||||||
use Modules\Microweber\MicroweberApacheVirtualHostConfig;
|
use Modules\Microweber\MicroweberApacheVirtualHostConfig;
|
||||||
|
|
||||||
class MicroweberServiceProvider extends ServiceProvider
|
class MicroweberServiceProvider extends ServiceProvider
|
||||||
|
@ -28,7 +27,7 @@ class MicroweberServiceProvider extends ServiceProvider
|
||||||
$this->registerViews();
|
$this->registerViews();
|
||||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
||||||
|
|
||||||
Event::listen(DomainIsCreated::class,DomainIsCreatedListener::class);
|
Event::listen(DomainIsCreated::class, DomainIsCreatedListener::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace Modules\Microweber\App\Providers;
|
namespace Modules\Microweber\App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Pages;
|
namespace Modules\Microweber\Filament\Clusters\Microweber\Pages;
|
||||||
|
|
||||||
use Filament\Forms\Components\Card;
|
|
||||||
use Filament\Forms\Components\Radio;
|
|
||||||
use Filament\Forms\Components\Section;
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\Tabs;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
||||||
use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
|
use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
|
||||||
|
@ -21,7 +18,6 @@ class Settings extends BaseSettings
|
||||||
|
|
||||||
protected static ?int $navigationSort = 3;
|
protected static ?int $navigationSort = 3;
|
||||||
|
|
||||||
|
|
||||||
public function schema(): array
|
public function schema(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -71,7 +67,6 @@ class Settings extends BaseSettings
|
||||||
])
|
])
|
||||||
->label('Allow customers to choose installation type'),
|
->label('Allow customers to choose installation type'),
|
||||||
|
|
||||||
|
|
||||||
Select::make('microweber.allow_customers_to_choose_installation_database_driver')
|
Select::make('microweber.allow_customers_to_choose_installation_database_driver')
|
||||||
->options([
|
->options([
|
||||||
'yes' => 'Yes',
|
'yes' => 'Yes',
|
||||||
|
@ -133,6 +128,6 @@ class Settings extends BaseSettings
|
||||||
->label('Allow resellers to use their own White Label'),
|
->label('Allow resellers to use their own White Label'),
|
||||||
|
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,14 @@ class Version extends Page
|
||||||
protected static ?int $navigationSort = 1;
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
public $currentVersionOfApp = 0;
|
public $currentVersionOfApp = 0;
|
||||||
|
|
||||||
public $latestVersionOfApp = 0;
|
public $latestVersionOfApp = 0;
|
||||||
|
|
||||||
public $latestDownloadDateOfApp = 0;
|
public $latestDownloadDateOfApp = 0;
|
||||||
|
|
||||||
public $supportedTemplates = [];
|
public $supportedTemplates = [];
|
||||||
public $supportedLanguages = [];
|
|
||||||
|
|
||||||
|
public $supportedLanguages = [];
|
||||||
|
|
||||||
protected function getViewData(): array
|
protected function getViewData(): array
|
||||||
{
|
{
|
||||||
|
@ -51,7 +53,7 @@ class Version extends Page
|
||||||
'totalAppTemplates' => count($this->supportedTemplates),
|
'totalAppTemplates' => count($this->supportedTemplates),
|
||||||
'appTemplates' => $this->supportedTemplates,
|
'appTemplates' => $this->supportedTemplates,
|
||||||
'supportedLanguages' => $this->supportedLanguages,
|
'supportedLanguages' => $this->supportedLanguages,
|
||||||
'supportedTemplates' => $this->supportedTemplates
|
'supportedTemplates' => $this->supportedTemplates,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,12 +62,12 @@ class Version extends Page
|
||||||
{
|
{
|
||||||
$sharedAppPath = config('microweber.sharedPaths.app');
|
$sharedAppPath = config('microweber.sharedPaths.app');
|
||||||
|
|
||||||
if (!is_dir(dirname($sharedAppPath))) {
|
if (! is_dir(dirname($sharedAppPath))) {
|
||||||
mkdir(dirname($sharedAppPath));
|
mkdir(dirname($sharedAppPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
$shellPath = '/usr/local/phyre/web/vendor/microweber-packages/shared-server-scripts/shell-scripts';
|
$shellPath = '/usr/local/phyre/web/vendor/microweber-packages/shared-server-scripts/shell-scripts';
|
||||||
ShellApi::exec('chmod +x ' . $shellPath . '/*');
|
ShellApi::exec('chmod +x '.$shellPath.'/*');
|
||||||
|
|
||||||
// Download core app
|
// Download core app
|
||||||
$status = $this->__getMicroweberDownloaderInstance()
|
$status = $this->__getMicroweberDownloaderInstance()
|
||||||
|
@ -88,7 +90,7 @@ class Version extends Page
|
||||||
// The module connector must have own instance of composer client
|
// The module connector must have own instance of composer client
|
||||||
$composerClient = new Client();
|
$composerClient = new Client();
|
||||||
$composerClient->packageServers = [
|
$composerClient->packageServers = [
|
||||||
'https://market.microweberapi.com/packages/microweberserverpackages/packages.json'
|
'https://market.microweberapi.com/packages/microweberserverpackages/packages.json',
|
||||||
];
|
];
|
||||||
|
|
||||||
return $composerClient;
|
return $composerClient;
|
||||||
|
@ -97,11 +99,11 @@ class Version extends Page
|
||||||
private function __getComposerLicensedInstance()
|
private function __getComposerLicensedInstance()
|
||||||
{
|
{
|
||||||
$composerClientLicensed = new Client();
|
$composerClientLicensed = new Client();
|
||||||
// if (Option::getOption('license_key_status', 'whitelabel_license') == 'valid') {
|
// if (Option::getOption('license_key_status', 'whitelabel_license') == 'valid') {
|
||||||
// $composerClientLicensed->addLicense([
|
// $composerClientLicensed->addLicense([
|
||||||
// 'local_key' => Option::getOption('license_key', 'whitelabel_license')
|
// 'local_key' => Option::getOption('license_key', 'whitelabel_license')
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return $composerClientLicensed;
|
return $composerClientLicensed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ use Filament\Forms\Components\Checkbox;
|
||||||
use Filament\Forms\Components\Section;
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Pages\Page;
|
|
||||||
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
||||||
use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
|
use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
|
||||||
|
|
||||||
|
@ -22,13 +21,12 @@ class Whitelabel extends BaseSettings
|
||||||
|
|
||||||
protected static ?string $navigationLabel = 'Whitelabel';
|
protected static ?string $navigationLabel = 'Whitelabel';
|
||||||
|
|
||||||
|
public static function getNavigationLabel(): string
|
||||||
public static function getNavigationLabel() : string
|
|
||||||
{
|
{
|
||||||
return self::$navigationLabel;
|
return self::$navigationLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle() : string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return self::$navigationLabel;
|
return self::$navigationLabel;
|
||||||
}
|
}
|
||||||
|
@ -84,12 +82,10 @@ class Whitelabel extends BaseSettings
|
||||||
Checkbox::make('microweber.whitelabel.enable_microweber_service_links')
|
Checkbox::make('microweber.whitelabel.enable_microweber_service_links')
|
||||||
->label('Enable Microweber Service Links'),
|
->label('Enable Microweber Service Links'),
|
||||||
|
|
||||||
|
|
||||||
Textarea::make('microweber.whitelabel.admin_colors_sass')
|
Textarea::make('microweber.whitelabel.admin_colors_sass')
|
||||||
->label('Enter "Admin colors" sass'),
|
->label('Enter "Admin colors" sass'),
|
||||||
|
|
||||||
|
]),
|
||||||
])
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,11 @@
|
||||||
|
|
||||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources;
|
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources;
|
||||||
|
|
||||||
use Modules\Microweber\App\Models\MicroweberInstallation;
|
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Modules\Microweber\App\Models\MicroweberInstallation;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages\ListInstallations;
|
use Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages\ListInstallations;
|
||||||
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
||||||
|
|
||||||
|
@ -27,7 +24,6 @@ class InstallationResource extends Resource
|
||||||
|
|
||||||
protected static ?int $navigationSort = 0;
|
protected static ?int $navigationSort = 0;
|
||||||
|
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
|
@ -44,9 +40,9 @@ class InstallationResource extends Resource
|
||||||
Tables\Columns\TextColumn::make('website.domain')->label('Domain'),
|
Tables\Columns\TextColumn::make('website.domain')->label('Domain'),
|
||||||
Tables\Columns\TextColumn::make('app_version')->label('Version'),
|
Tables\Columns\TextColumn::make('app_version')->label('Version'),
|
||||||
Tables\Columns\TextColumn::make('installation_type')->label('Type'),
|
Tables\Columns\TextColumn::make('installation_type')->label('Type'),
|
||||||
// Tables\Columns\TextColumn::make('installation_path')->label('Path'),
|
// Tables\Columns\TextColumn::make('installation_path')->label('Path'),
|
||||||
Tables\Columns\TextColumn::make('template')->label('Template'),
|
Tables\Columns\TextColumn::make('template')->label('Template'),
|
||||||
// Tables\Columns\TextColumn::make('admin_email')->label('Admin Email'),
|
// Tables\Columns\TextColumn::make('admin_email')->label('Admin Email'),
|
||||||
|
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
|
@ -73,8 +69,8 @@ class InstallationResource extends Resource
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'index' => ListInstallations::route('/'),
|
'index' => ListInstallations::route('/'),
|
||||||
// 'create' => Pages\CreateInstallation::route('/create'),
|
// 'create' => Pages\CreateInstallation::route('/create'),
|
||||||
// 'edit' => Pages\EditInstallation::route('/{record}/edit'),
|
// 'edit' => Pages\EditInstallation::route('/{record}/edit'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages;
|
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
use Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource;
|
use Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages;
|
namespace Modules\Microweber\Filament\Clusters\Microweber\Resources\InstallationResource\Pages;
|
||||||
|
|
||||||
use Modules\Microweber\Filament\Admin\Resources\InstallationResource;
|
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
use Modules\Microweber\Filament\Admin\Resources\InstallationResource;
|
||||||
|
|
||||||
class EditInstallation extends EditRecord
|
class EditInstallation extends EditRecord
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ListInstallations extends ListRecords
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Actions\CreateAction::make(),
|
Actions\CreateAction::make(),
|
||||||
Actions\Action::make('Scan for installations')->action('scanForInstallations')
|
Actions\Action::make('Scan for installations')->action('scanForInstallations'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ class ListInstallations extends ListRecords
|
||||||
|
|
||||||
$installations = $scan->scanRecusrive();
|
$installations = $scan->scanRecusrive();
|
||||||
|
|
||||||
if (!empty($installations)) {
|
if (! empty($installations)) {
|
||||||
foreach ($installations as $installation) {
|
foreach ($installations as $installation) {
|
||||||
|
|
||||||
$findInstallation = MicroweberInstallation::where('installation_path', $installation['path'])
|
$findInstallation = MicroweberInstallation::where('installation_path', $installation['path'])
|
||||||
->where('domain_id', $domain->id)
|
->where('domain_id', $domain->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (!$findInstallation) {
|
if (! $findInstallation) {
|
||||||
$findInstallation = new MicroweberInstallation();
|
$findInstallation = new MicroweberInstallation();
|
||||||
$findInstallation->domain_id = $domain->id;
|
$findInstallation->domain_id = $domain->id;
|
||||||
$findInstallation->installation_path = $installation['path'];
|
$findInstallation->installation_path = $installation['path'];
|
||||||
|
@ -62,7 +62,7 @@ class ListInstallations extends ListRecords
|
||||||
$getAppInstallations = MicroweberInstallation::get();
|
$getAppInstallations = MicroweberInstallation::get();
|
||||||
if ($getAppInstallations != null) {
|
if ($getAppInstallations != null) {
|
||||||
foreach ($getAppInstallations as $appInstallation) {
|
foreach ($getAppInstallations as $appInstallation) {
|
||||||
if (!is_file($appInstallation['installation_path'] . '/config/microweber.php')) {
|
if (! is_file($appInstallation['installation_path'].'/config/microweber.php')) {
|
||||||
$appInstallation->delete();
|
$appInstallation->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,4 @@ class MicroweberCluster extends Cluster
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-squares-2x2';
|
protected static ?string $navigationIcon = 'heroicon-o-squares-2x2';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Server Management';
|
protected static ?string $navigationGroup = 'Server Management';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,7 @@ use App\Events\DomainIsCreated;
|
||||||
use App\Models\Domain;
|
use App\Models\Domain;
|
||||||
use App\Models\HostingPlan;
|
use App\Models\HostingPlan;
|
||||||
use App\Models\HostingSubscription;
|
use App\Models\HostingSubscription;
|
||||||
use App\ShellApi;
|
|
||||||
use Modules\Microweber\App\Models\MicroweberInstallation;
|
use Modules\Microweber\App\Models\MicroweberInstallation;
|
||||||
use Psy\Shell;
|
|
||||||
|
|
||||||
class DomainIsCreatedListener
|
class DomainIsCreatedListener
|
||||||
{
|
{
|
||||||
|
@ -26,20 +24,20 @@ class DomainIsCreatedListener
|
||||||
public function handle(DomainIsCreated $event): void
|
public function handle(DomainIsCreated $event): void
|
||||||
{
|
{
|
||||||
$findDomain = Domain::where('id', $event->model->id)->first();
|
$findDomain = Domain::where('id', $event->model->id)->first();
|
||||||
if (!$findDomain) {
|
if (! $findDomain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$findHostingSubscription = HostingSubscription::where('id', $findDomain->hosting_subscription_id)->first();
|
$findHostingSubscription = HostingSubscription::where('id', $findDomain->hosting_subscription_id)->first();
|
||||||
if (!$findHostingSubscription) {
|
if (! $findHostingSubscription) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$findHostingPlan = HostingPlan::where('id', $findHostingSubscription->hosting_plan_id)->first();
|
$findHostingPlan = HostingPlan::where('id', $findHostingSubscription->hosting_plan_id)->first();
|
||||||
if (!$findHostingPlan) {
|
if (! $findHostingPlan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array('microweber', $findHostingPlan->additional_services)) {
|
if (! in_array('microweber', $findHostingPlan->additional_services)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +58,7 @@ class DomainIsCreatedListener
|
||||||
$install->setLanguage($installationLanguage);
|
$install->setLanguage($installationLanguage);
|
||||||
$install->setTemplate($installationTemplate);
|
$install->setTemplate($installationTemplate);
|
||||||
|
|
||||||
// $install->setStandaloneInstallation();
|
// $install->setStandaloneInstallation();
|
||||||
$install->setSymlinkInstallation();
|
$install->setSymlinkInstallation();
|
||||||
$install->setDatabaseDriver('sqlite');
|
$install->setDatabaseDriver('sqlite');
|
||||||
|
|
||||||
|
@ -68,33 +66,32 @@ class DomainIsCreatedListener
|
||||||
$install->setAdminUsername('bojotjo');
|
$install->setAdminUsername('bojotjo');
|
||||||
$install->setAdminPassword('bojotjo');
|
$install->setAdminPassword('bojotjo');
|
||||||
|
|
||||||
$status = $install->run();
|
$status = $install->run();
|
||||||
|
|
||||||
if (isset($status['success']) && $status['success']) {
|
if (isset($status['success']) && $status['success']) {
|
||||||
|
|
||||||
$findInstallation = MicroweberInstallation::where('installation_path', $findDomain->domain_public)
|
$findInstallation = MicroweberInstallation::where('installation_path', $findDomain->domain_public)
|
||||||
->where('domain_id', $findDomain->id)
|
->where('domain_id', $findDomain->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (!$findInstallation) {
|
if (! $findInstallation) {
|
||||||
$findInstallation = new MicroweberInstallation();
|
$findInstallation = new MicroweberInstallation();
|
||||||
$findInstallation->domain_id = $findDomain->id;
|
$findInstallation->domain_id = $findDomain->id;
|
||||||
$findInstallation->installation_path = $findDomain->domain_public;
|
$findInstallation->installation_path = $findDomain->domain_public;
|
||||||
}
|
}
|
||||||
|
|
||||||
$findInstallation->app_version = 'latest';
|
$findInstallation->app_version = 'latest';
|
||||||
$findInstallation->template = $installationTemplate;
|
$findInstallation->template = $installationTemplate;
|
||||||
|
|
||||||
if ($installationType == 'symlink') {
|
if ($installationType == 'symlink') {
|
||||||
$findInstallation->installation_type = 'symlink';
|
$findInstallation->installation_type = 'symlink';
|
||||||
} else {
|
} else {
|
||||||
$findInstallation->installation_type = 'standalone';
|
$findInstallation->installation_type = 'standalone';
|
||||||
}
|
}
|
||||||
|
|
||||||
$findInstallation->save();
|
$findInstallation->save();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ use App\VirtualHosts\ApacheVirtualHostConfigBase;
|
||||||
class MicroweberApacheVirtualHostConfig extends ApacheVirtualHostConfigBase
|
class MicroweberApacheVirtualHostConfig extends ApacheVirtualHostConfigBase
|
||||||
{
|
{
|
||||||
public array $phpAdminValueOpenBaseDirs = [
|
public array $phpAdminValueOpenBaseDirs = [
|
||||||
'/usr/share/microweber'
|
'/usr/share/microweber',
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,12 @@ use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
|
|
||||||
class AdminPanelProvider extends PanelProvider
|
class AdminPanelProvider extends PanelProvider
|
||||||
{
|
{
|
||||||
private string $module = "Microweber";
|
private string $module = 'Microweber';
|
||||||
|
|
||||||
public function panel(Panel $panel): Panel
|
public function panel(Panel $panel): Panel
|
||||||
{
|
{
|
||||||
$moduleNamespace = $this->getModuleNamespace();
|
$moduleNamespace = $this->getModuleNamespace();
|
||||||
|
|
||||||
return $panel
|
return $panel
|
||||||
->id('microweber::admin')
|
->id('microweber::admin')
|
||||||
->path('microweber/admin')
|
->path('microweber/admin')
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Modules\Microweber\Shell\Adapters;
|
namespace Modules\Microweber\Shell\Adapters;
|
||||||
|
|
||||||
use App\ShellApi;
|
use App\ShellApi;
|
||||||
use MicroweberPackages\SharedServerScripts\Shell\Adapters\IShellExecutor;
|
use MicroweberPackages\SharedServerScripts\Shell\Adapters\IShellExecutor;
|
||||||
use MicroweberPackages\SharedServerScripts\Shell\Adapters\pm_ApiCli;
|
|
||||||
|
|
||||||
class PhyreShellExecutor implements IShellExecutor
|
class PhyreShellExecutor implements IShellExecutor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $file
|
|
||||||
* @param array $args
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function executeFile(string $file, array $args)
|
public function executeFile(string $file, array $args)
|
||||||
|
@ -23,12 +21,12 @@ class PhyreShellExecutor implements IShellExecutor
|
||||||
{
|
{
|
||||||
$commandAsLine = implode(' ', $command);
|
$commandAsLine = implode(' ', $command);
|
||||||
|
|
||||||
// dd([
|
// dd([
|
||||||
// 'command' => $command,
|
// 'command' => $command,
|
||||||
// 'path' => $path,
|
// 'path' => $path,
|
||||||
// 'args' => $args,
|
// 'args' => $args,
|
||||||
// 'commandAsLine' => $commandAsLine
|
// 'commandAsLine' => $commandAsLine
|
||||||
// ]);
|
// ]);
|
||||||
return ShellApi::exec($commandAsLine);
|
return ShellApi::exec($commandAsLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => 'Microweber',
|
'name' => 'Microweber',
|
||||||
'sharedPaths'=>[
|
'sharedPaths' => [
|
||||||
'app'=>'/usr/share/microweber/latest',
|
'app' => '/usr/share/microweber/latest',
|
||||||
'modules'=>'/usr/share/microweber/latest/userfiles/modules',
|
'modules' => '/usr/share/microweber/latest/userfiles/modules',
|
||||||
'templates'=>'/usr/share/microweber/latest/userfiles/templates'
|
'templates' => '/usr/share/microweber/latest/userfiles/templates',
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -8,12 +8,15 @@ use App\ShellApi;
|
||||||
class ApacheWebsiteApplySSLVirtualHost
|
class ApacheWebsiteApplySSLVirtualHost
|
||||||
{
|
{
|
||||||
public $domain;
|
public $domain;
|
||||||
|
|
||||||
public $domainRoot;
|
public $domainRoot;
|
||||||
|
|
||||||
public $domainPublic;
|
public $domainPublic;
|
||||||
|
|
||||||
public $sslCertificateFilePath;
|
public $sslCertificateFilePath;
|
||||||
|
|
||||||
public $sslCertificateKeyFilePath;
|
public $sslCertificateKeyFilePath;
|
||||||
|
|
||||||
public $sslCertificateChainFilePath;
|
public $sslCertificateChainFilePath;
|
||||||
|
|
||||||
public function setSslCertificateFilePath($sslCertificateFilePath)
|
public function setSslCertificateFilePath($sslCertificateFilePath)
|
||||||
|
@ -49,7 +52,7 @@ class ApacheWebsiteApplySSLVirtualHost
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$settings = [
|
$settings = [
|
||||||
'port'=> 443,
|
'port' => 443,
|
||||||
'domain' => $this->domain,
|
'domain' => $this->domain,
|
||||||
'domainRoot' => $this->domainRoot,
|
'domainRoot' => $this->domainRoot,
|
||||||
'domainPublic' => $this->domainPublic,
|
'domainPublic' => $this->domainPublic,
|
||||||
|
@ -58,16 +61,16 @@ class ApacheWebsiteApplySSLVirtualHost
|
||||||
'sslCertificateKeyFilePath' => $this->sslCertificateKeyFilePath,
|
'sslCertificateKeyFilePath' => $this->sslCertificateKeyFilePath,
|
||||||
'sslCertificateChainFilePath' => $this->sslCertificateChainFilePath,
|
'sslCertificateChainFilePath' => $this->sslCertificateChainFilePath,
|
||||||
];
|
];
|
||||||
$apache2SSLSample = view('actions.samples.ubuntu.apache2-ssl-conf',$settings)->render();
|
$apache2SSLSample = view('actions.samples.ubuntu.apache2-ssl-conf', $settings)->render();
|
||||||
|
|
||||||
$fileManagerApi = new FileManagerApi();
|
$fileManagerApi = new FileManagerApi();
|
||||||
|
|
||||||
$apache2SSLOptionsSample = view('actions.samples.ubuntu.apache2-ssl-options-conf')->render();
|
$apache2SSLOptionsSample = view('actions.samples.ubuntu.apache2-ssl-options-conf')->render();
|
||||||
$apache2SSLOptionsFilePath = '/etc/apache2/phyre/options-ssl-apache.conf';
|
$apache2SSLOptionsFilePath = '/etc/apache2/phyre/options-ssl-apache.conf';
|
||||||
if (!$fileManagerApi->isDir('/etc/apache2/phyre')) {
|
if (! $fileManagerApi->isDir('/etc/apache2/phyre')) {
|
||||||
$fileManagerApi->mkdir('/etc/apache2/phyre');
|
$fileManagerApi->mkdir('/etc/apache2/phyre');
|
||||||
}
|
}
|
||||||
if (!$fileManagerApi->fileExists($apache2SSLOptionsFilePath)) {
|
if (! $fileManagerApi->fileExists($apache2SSLOptionsFilePath)) {
|
||||||
$fileManagerApi->filePutContents($apache2SSLOptionsFilePath, $apache2SSLOptionsSample);
|
$fileManagerApi->filePutContents($apache2SSLOptionsFilePath, $apache2SSLOptionsSample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,20 @@
|
||||||
|
|
||||||
namespace App\Actions;
|
namespace App\Actions;
|
||||||
|
|
||||||
use App\FileManagerApi;
|
|
||||||
use App\ShellApi;
|
|
||||||
use App\VirtualHosts\ApacheVirtualHostManager;
|
|
||||||
|
|
||||||
class ApacheWebsiteCreate
|
class ApacheWebsiteCreate
|
||||||
{
|
{
|
||||||
public $domain;
|
public $domain;
|
||||||
|
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
public $password;
|
public $password;
|
||||||
|
|
||||||
public $isMainDomain = false;
|
public $isMainDomain = false;
|
||||||
|
|
||||||
public $additionalServices = [];
|
public $additionalServices = [];
|
||||||
|
|
||||||
public $features = [];
|
public $features = [];
|
||||||
|
|
||||||
public function setDomain($domain)
|
public function setDomain($domain)
|
||||||
|
@ -62,15 +64,15 @@ class ApacheWebsiteCreate
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isMainDomain) {
|
if ($this->isMainDomain) {
|
||||||
$allDomainsRoot = '/home/' . $this->user . '/public_html';
|
$allDomainsRoot = '/home/'.$this->user.'/public_html';
|
||||||
$domainRoot = '/home/' . $this->user;
|
$domainRoot = '/home/'.$this->user;
|
||||||
$domainPublic = '/home/' . $this->user . '/public_html';
|
$domainPublic = '/home/'.$this->user.'/public_html';
|
||||||
$homeRoot = '/home/' . $this->user;
|
$homeRoot = '/home/'.$this->user;
|
||||||
} else {
|
} else {
|
||||||
$allDomainsRoot = '/home/' . $this->user . '/domains';
|
$allDomainsRoot = '/home/'.$this->user.'/domains';
|
||||||
$domainRoot = '/home/' . $this->user . '/domains/' . $this->domain;
|
$domainRoot = '/home/'.$this->user.'/domains/'.$this->domain;
|
||||||
$domainPublic = $domainRoot . '/public_html';
|
$domainPublic = $domainRoot.'/public_html';
|
||||||
$homeRoot = '/home/' . $this->user;
|
$homeRoot = '/home/'.$this->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
$apacheVirtualHostConfigs = app()->virtualHostManager->getConfigs($this->additionalServices);
|
$apacheVirtualHostConfigs = app()->virtualHostManager->getConfigs($this->additionalServices);
|
||||||
|
@ -89,23 +91,22 @@ class ApacheWebsiteCreate
|
||||||
$settings = array_merge($settings, $apacheVirtualHostConfigs);
|
$settings = array_merge($settings, $apacheVirtualHostConfigs);
|
||||||
$apache2Sample = view('actions.samples.ubuntu.apache2-conf', $settings)->render();
|
$apache2Sample = view('actions.samples.ubuntu.apache2-conf', $settings)->render();
|
||||||
|
|
||||||
if (!is_dir($homeRoot)) {
|
if (! is_dir($homeRoot)) {
|
||||||
mkdir($homeRoot);
|
mkdir($homeRoot);
|
||||||
}
|
}
|
||||||
if (!is_dir($allDomainsRoot)) {
|
if (! is_dir($allDomainsRoot)) {
|
||||||
mkdir($allDomainsRoot);
|
mkdir($allDomainsRoot);
|
||||||
}
|
}
|
||||||
if (!is_dir($domainRoot)) {
|
if (! is_dir($domainRoot)) {
|
||||||
mkdir($domainRoot);
|
mkdir($domainRoot);
|
||||||
}
|
}
|
||||||
if (!is_dir($domainPublic)) {
|
if (! is_dir($domainPublic)) {
|
||||||
mkdir($domainPublic);
|
mkdir($domainPublic);
|
||||||
}
|
}
|
||||||
|
|
||||||
shell_exec('chmod -R 775 /etc/apache2/sites-available/');
|
shell_exec('chmod -R 775 /etc/apache2/sites-available/');
|
||||||
|
|
||||||
file_put_contents('/etc/apache2/sites-available/' . $settings['domain'] . '.conf', $apache2Sample);
|
file_put_contents('/etc/apache2/sites-available/'.$settings['domain'].'.conf', $apache2Sample);
|
||||||
|
|
||||||
|
|
||||||
$indexContent = '
|
$indexContent = '
|
||||||
|
|
||||||
|
@ -115,22 +116,21 @@ class ApacheWebsiteCreate
|
||||||
|
|
||||||
';
|
';
|
||||||
|
|
||||||
|
file_put_contents($settings['domainPublic'].'/index.php', $indexContent);
|
||||||
|
|
||||||
file_put_contents($settings['domainPublic'] . '/index.php', $indexContent);
|
shell_exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$allDomainsRoot);
|
||||||
|
shell_exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$homeRoot);
|
||||||
|
|
||||||
shell_exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $allDomainsRoot);
|
shell_exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$settings['domainRoot']);
|
||||||
shell_exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $homeRoot);
|
shell_exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$settings['domainPublic']);
|
||||||
|
|
||||||
shell_exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $settings['domainRoot']);
|
shell_exec('chmod -R 775 '.$allDomainsRoot);
|
||||||
shell_exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $settings['domainPublic']);
|
shell_exec('chmod -R 775 '.$homeRoot);
|
||||||
|
|
||||||
shell_exec('chmod -R 775 ' . $allDomainsRoot);
|
shell_exec('chmod -R 775 '.$settings['domainRoot']);
|
||||||
shell_exec('chmod -R 775 ' . $homeRoot);
|
shell_exec('chmod -R 775 '.$settings['domainPublic']);
|
||||||
|
|
||||||
shell_exec('chmod -R 775 ' . $settings['domainRoot']);
|
shell_exec('a2ensite '.$settings['domain'].'.conf');
|
||||||
shell_exec('chmod -R 775 ' . $settings['domainPublic']);
|
|
||||||
|
|
||||||
shell_exec('a2ensite ' . $settings['domain'] . '.conf');
|
|
||||||
shell_exec('systemctl reload apache2');
|
shell_exec('systemctl reload apache2');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -141,7 +141,7 @@ class ApacheWebsiteCreate
|
||||||
'user' => $this->user,
|
'user' => $this->user,
|
||||||
'email' => $this->email,
|
'email' => $this->email,
|
||||||
'linuxUser' => $linuxUser,
|
'linuxUser' => $linuxUser,
|
||||||
'apache2Sample' => $apache2Sample
|
'apache2Sample' => $apache2Sample,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,18 +16,17 @@ class ApacheWebsiteDelete
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$apacheConf = '/etc/apache2/sites-available/'.$this->domain.'.conf';
|
$apacheConf = '/etc/apache2/sites-available/'.$this->domain.'.conf';
|
||||||
ShellApi::exec('rm -rf ' . $apacheConf);
|
ShellApi::exec('rm -rf '.$apacheConf);
|
||||||
|
|
||||||
$apacheConfEnabled = '/etc/apache2/sites-enabled/'.$this->domain.'.conf';
|
$apacheConfEnabled = '/etc/apache2/sites-enabled/'.$this->domain.'.conf';
|
||||||
ShellApi::exec('rm -rf ' . $apacheConfEnabled);
|
ShellApi::exec('rm -rf '.$apacheConfEnabled);
|
||||||
|
|
||||||
|
|
||||||
// SSL
|
// SSL
|
||||||
$apacheSSLConf = '/etc/apache2/sites-available/'.$this->domain.'-ssl.conf';
|
$apacheSSLConf = '/etc/apache2/sites-available/'.$this->domain.'-ssl.conf';
|
||||||
ShellApi::exec('rm -rf ' . $apacheSSLConf);
|
ShellApi::exec('rm -rf '.$apacheSSLConf);
|
||||||
|
|
||||||
$apacheSSLConfEnabled = '/etc/apache2/sites-enabled/'.$this->domain.'-ssl.conf';
|
$apacheSSLConfEnabled = '/etc/apache2/sites-enabled/'.$this->domain.'-ssl.conf';
|
||||||
ShellApi::exec('rm -rf ' . $apacheSSLConfEnabled);
|
ShellApi::exec('rm -rf '.$apacheSSLConfEnabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,9 @@ use App\ShellApi;
|
||||||
class CreateLinuxUser
|
class CreateLinuxUser
|
||||||
{
|
{
|
||||||
public $username;
|
public $username;
|
||||||
|
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
public $password;
|
public $password;
|
||||||
|
|
||||||
public function setUsername($username)
|
public function setUsername($username)
|
||||||
|
@ -29,6 +31,7 @@ class CreateLinuxUser
|
||||||
{
|
{
|
||||||
$this->isWebUser = true;
|
$this->isWebUser = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$output = '';
|
$output = '';
|
||||||
|
@ -41,7 +44,7 @@ class CreateLinuxUser
|
||||||
$output .= ShellApi::exec($command);
|
$output .= ShellApi::exec($command);
|
||||||
|
|
||||||
$command = 'echo '.$username.':'.$password.' | sudo chpasswd -e';
|
$command = 'echo '.$username.':'.$password.' | sudo chpasswd -e';
|
||||||
$output .= ShellApi::exec($command);
|
$output .= ShellApi::exec($command);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,9 @@ use App\ShellApi;
|
||||||
class CreateLinuxWebUser
|
class CreateLinuxWebUser
|
||||||
{
|
{
|
||||||
public $username;
|
public $username;
|
||||||
|
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
public $password;
|
public $password;
|
||||||
|
|
||||||
public function setUsername($username)
|
public function setUsername($username)
|
||||||
|
@ -33,7 +35,7 @@ class CreateLinuxWebUser
|
||||||
$command = 'groupadd '.$username;
|
$command = 'groupadd '.$username;
|
||||||
$output .= ShellApi::exec($command);
|
$output .= ShellApi::exec($command);
|
||||||
|
|
||||||
$command = 'usermod -a -G www-data ' . $username;
|
$command = 'usermod -a -G www-data '.$username;
|
||||||
$output .= ShellApi::exec($command);
|
$output .= ShellApi::exec($command);
|
||||||
|
|
||||||
$command = 'echo '.$username.':'.$password.' | chpasswd -e';
|
$command = 'echo '.$username.':'.$password.' | chpasswd -e';
|
||||||
|
|
|
@ -6,6 +6,6 @@ class ApiClient
|
||||||
{
|
{
|
||||||
public static function getPhyrePHP()
|
public static function getPhyrePHP()
|
||||||
{
|
{
|
||||||
return "/usr/local/phyre/php/bin/php";
|
return '/usr/local/phyre/php/bin/php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ApachePingWebsitesWithCurl extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve all website configurations from the database
|
// Retrieve all website configurations from the database
|
||||||
$websiteConfigs = Domain::get();
|
$websiteConfigs = Domain::get();
|
||||||
|
|
||||||
foreach ($websiteConfigs as $config) {
|
foreach ($websiteConfigs as $config) {
|
||||||
$domain = $config->domain;
|
$domain = $config->domain;
|
||||||
|
@ -57,8 +57,6 @@ class ApachePingWebsitesWithCurl extends Command
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,6 +12,7 @@ class ModelCustomerDeleting
|
||||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
public $model;
|
public $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,6 +12,7 @@ class ModelDomainDeleting
|
||||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
public $model;
|
public $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,6 +12,7 @@ class ModelHostingSubscriptionCreated
|
||||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
public $model;
|
public $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,6 +12,7 @@ class ModelHostingSubscriptionDeleting
|
||||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
public $model;
|
public $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,47 +16,45 @@ class Modules extends Page
|
||||||
|
|
||||||
protected static ?int $navigationSort = 1;
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
|
|
||||||
protected function getViewData(): array
|
protected function getViewData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'categories' => [
|
'categories' => [
|
||||||
'Security'=>[
|
'Security' => [
|
||||||
[
|
[
|
||||||
'name' => 'Lets Encrypt',
|
'name' => 'Lets Encrypt',
|
||||||
'description' => 'Automatically secure your website with a free SSL certificate from Lets Encrypt.',
|
'description' => 'Automatically secure your website with a free SSL certificate from Lets Encrypt.',
|
||||||
'url' => url('admin/letsencrypt'),
|
'url' => url('admin/letsencrypt'),
|
||||||
'iconUrl' => url('images/modules/letsencrypt.png'),
|
'iconUrl' => url('images/modules/letsencrypt.png'),
|
||||||
'category' => 'Security'
|
'category' => 'Security',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'Content Management'=>[
|
'Content Management' => [
|
||||||
[
|
[
|
||||||
'name' => 'Microweber',
|
'name' => 'Microweber',
|
||||||
'description' => 'A drag and drop website builder and a powerful next-generation CMS.',
|
'description' => 'A drag and drop website builder and a powerful next-generation CMS.',
|
||||||
'url' => url('admin/microweber'),
|
'url' => url('admin/microweber'),
|
||||||
'iconUrl' => url('images/modules/microweber.png'),
|
'iconUrl' => url('images/modules/microweber.png'),
|
||||||
'category' => 'Content Management'
|
'category' => 'Content Management',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name'=>'WordPress',
|
'name' => 'WordPress',
|
||||||
'description'=>'WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database.',
|
'description' => 'WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database.',
|
||||||
'url' => url('admin/wordpress'),
|
'url' => url('admin/wordpress'),
|
||||||
'iconUrl'=>url('images/modules/wordpress.svg'),
|
'iconUrl' => url('images/modules/wordpress.svg'),
|
||||||
'category'=>'Content Management'
|
'category' => 'Content Management',
|
||||||
]
|
|
||||||
],
|
|
||||||
'E-Commerce'=>[
|
|
||||||
[
|
|
||||||
'name'=>'OpenCart',
|
|
||||||
'description'=>'A free shopping cart system. OpenCart is an open source PHP-based online e-commerce solution.',
|
|
||||||
'url' => url('admin/opencart'),
|
|
||||||
'iconUrl'=>url('images/modules/opencart.png'),
|
|
||||||
'category'=>'E-Commerce'
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]
|
'E-Commerce' => [
|
||||||
|
[
|
||||||
|
'name' => 'OpenCart',
|
||||||
|
'description' => 'A free shopping cart system. OpenCart is an open source PHP-based online e-commerce solution.',
|
||||||
|
'url' => url('admin/opencart'),
|
||||||
|
'iconUrl' => url('images/modules/opencart.png'),
|
||||||
|
'category' => 'E-Commerce',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Pages\Settings;
|
namespace App\Filament\Pages\Settings;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
|
@ -8,7 +9,6 @@ use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
|
||||||
|
|
||||||
class Settings extends BaseSettings
|
class Settings extends BaseSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Server Management';
|
protected static ?string $navigationGroup = 'Server Management';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 2;
|
protected static ?int $navigationSort = 2;
|
||||||
|
|
|
@ -3,15 +3,11 @@
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\BackupResource\Pages;
|
use App\Filament\Resources\BackupResource\Pages;
|
||||||
use App\Filament\Resources\BackupResource\RelationManagers;
|
|
||||||
use App\Models\Backup;
|
use App\Models\Backup;
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class BackupResource extends Resource
|
class BackupResource extends Resource
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Filament\Resources\BackupResource\Pages;
|
namespace App\Filament\Resources\BackupResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\BackupResource;
|
use App\Filament\Resources\BackupResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateBackup extends CreateRecord
|
class CreateBackup extends CreateRecord
|
||||||
|
|
|
@ -3,15 +3,12 @@
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\CronJobResource\Pages;
|
use App\Filament\Resources\CronJobResource\Pages;
|
||||||
use App\Filament\Resources\CronJobResource\RelationManagers;
|
|
||||||
use App\Models\CronJob;
|
use App\Models\CronJob;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class CronJobResource extends Resource
|
class CronJobResource extends Resource
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Filament\Resources\CronJobResource\Pages;
|
namespace App\Filament\Resources\CronJobResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\CronJobResource;
|
use App\Filament\Resources\CronJobResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateCronJob extends CreateRecord
|
class CreateCronJob extends CreateRecord
|
||||||
|
|
|
@ -3,16 +3,12 @@
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\CustomerResource\Pages;
|
use App\Filament\Resources\CustomerResource\Pages;
|
||||||
use App\Filament\Resources\CustomerResource\RelationManagers;
|
|
||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
use Faker\Provider\Text;
|
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class CustomerResource extends Resource
|
class CustomerResource extends Resource
|
||||||
{
|
{
|
||||||
|
@ -71,7 +67,7 @@ class CustomerResource extends Resource
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('email')
|
Tables\Columns\TextColumn::make('email')
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable()
|
->sortable(),
|
||||||
])
|
])
|
||||||
->defaultSort('id', 'desc')
|
->defaultSort('id', 'desc')
|
||||||
->filters([
|
->filters([
|
||||||
|
@ -99,9 +95,9 @@ class CustomerResource extends Resource
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'index' => Pages\ManageCustomers::route('/'),
|
'index' => Pages\ManageCustomers::route('/'),
|
||||||
// 'index' => Pages\ListCustomers::route('/'),
|
// 'index' => Pages\ListCustomers::route('/'),
|
||||||
// 'create' => Pages\CreateCustomer::route('/create'),
|
// 'create' => Pages\CreateCustomer::route('/create'),
|
||||||
// 'edit' => Pages\EditCustomer::route('/{record}/edit'),
|
// 'edit' => Pages\EditCustomer::route('/{record}/edit'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Filament\Resources\CustomerResource\Pages;
|
namespace App\Filament\Resources\CustomerResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\CustomerResource;
|
use App\Filament\Resources\CustomerResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateCustomer extends CreateRecord
|
class CreateCustomer extends CreateRecord
|
||||||
|
|
|
@ -25,7 +25,7 @@ class EditCustomer extends EditRecord
|
||||||
->send();
|
->send();
|
||||||
$action->cancel();
|
$action->cancel();
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Filament\Resources\CustomerResource\Pages;
|
namespace App\Filament\Resources\CustomerResource\Pages;
|
||||||
|
|
||||||
|
|
||||||
use App\Filament\Resources\CustomerResource;
|
use App\Filament\Resources\CustomerResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Resources\Pages\ManageRecords;
|
use Filament\Resources\Pages\ManageRecords;
|
||||||
|
|
|
@ -3,16 +3,11 @@
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\DomainResource\Pages;
|
use App\Filament\Resources\DomainResource\Pages;
|
||||||
use App\Filament\Resources\DomainResource\RelationManagers;
|
|
||||||
use App\Models\Domain;
|
use App\Models\Domain;
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class DomainResource extends Resource
|
class DomainResource extends Resource
|
||||||
{
|
{
|
||||||
|
@ -29,7 +24,6 @@ class DomainResource extends Resource
|
||||||
return $form
|
return $form
|
||||||
->schema([
|
->schema([
|
||||||
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,13 +35,13 @@ class DomainResource extends Resource
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
// Tables\Columns\TextColumn::make('hostingPlan.name')
|
// Tables\Columns\TextColumn::make('hostingPlan.name')
|
||||||
// ->searchable()
|
// ->searchable()
|
||||||
// ->sortable(),
|
// ->sortable(),
|
||||||
|
|
||||||
// Tables\Columns\TextColumn::make('customer.name')
|
// Tables\Columns\TextColumn::make('customer.name')
|
||||||
// ->searchable()
|
// ->searchable()
|
||||||
// ->sortable(),
|
// ->sortable(),
|
||||||
|
|
||||||
])
|
])
|
||||||
->defaultSort('id', 'desc')
|
->defaultSort('id', 'desc')
|
||||||
|
@ -59,11 +53,11 @@ class DomainResource extends Resource
|
||||||
->label('Open website')
|
->label('Open website')
|
||||||
->icon('heroicon-m-arrow-top-right-on-square')
|
->icon('heroicon-m-arrow-top-right-on-square')
|
||||||
->color('gray')
|
->color('gray')
|
||||||
->url(fn ($record): string => 'http://' . $record->domain, true),
|
->url(fn ($record): string => 'http://'.$record->domain, true),
|
||||||
])
|
])
|
||||||
->bulkActions([
|
->bulkActions([
|
||||||
Tables\Actions\BulkActionGroup::make([
|
Tables\Actions\BulkActionGroup::make([
|
||||||
// Tables\Actions\DeleteBulkAction::make(),
|
// Tables\Actions\DeleteBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -79,8 +73,8 @@ class DomainResource extends Resource
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'index' => Pages\ListWebsites::route('/'),
|
'index' => Pages\ListWebsites::route('/'),
|
||||||
// 'create' => Pages\CreateWebsite::route('/create'),
|
// 'create' => Pages\CreateWebsite::route('/create'),
|
||||||
// 'edit' => Pages\EditWebsite::route('/{record}/edit'),
|
// 'edit' => Pages\EditWebsite::route('/{record}/edit'),
|
||||||
'view' => Pages\ViewWebsite::route('/{record}'),
|
'view' => Pages\ViewWebsite::route('/{record}'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Filament\Resources\DomainResource\Pages;
|
namespace App\Filament\Resources\DomainResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\DomainResource;
|
use App\Filament\Resources\DomainResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateWebsite extends CreateRecord
|
class CreateWebsite extends CreateRecord
|
||||||
|
|
|
@ -13,7 +13,7 @@ class EditWebsite extends EditRecord
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
// Actions\DeleteAction::make(),
|
// Actions\DeleteAction::make(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Filament\Resources\DomainResource\Pages;
|
namespace App\Filament\Resources\DomainResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\DomainResource;
|
use App\Filament\Resources\DomainResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ViewRecord;
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
|
|
||||||
class ViewWebsite extends ViewRecord
|
class ViewWebsite extends ViewRecord
|
||||||
|
@ -11,5 +10,4 @@ class ViewWebsite extends ViewRecord
|
||||||
protected static string $resource = DomainResource::class;
|
protected static string $resource = DomainResource::class;
|
||||||
|
|
||||||
protected static string $view = 'filament.resources.website.pages.view-website';
|
protected static string $view = 'filament.resources.website.pages.view-website';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,12 @@
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\HostingPlanResource\Pages;
|
use App\Filament\Resources\HostingPlanResource\Pages;
|
||||||
use App\Filament\Resources\HostingPlanResource\RelationManagers;
|
|
||||||
use App\Models\HostingPlan;
|
use App\Models\HostingPlan;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class HostingPlanResource extends Resource
|
class HostingPlanResource extends Resource
|
||||||
{
|
{
|
||||||
|
@ -108,11 +105,10 @@ class HostingPlanResource extends Resource
|
||||||
->label('Features')
|
->label('Features')
|
||||||
->options([
|
->options([
|
||||||
'ssl' => 'SSL',
|
'ssl' => 'SSL',
|
||||||
'backup' => 'Backup'
|
'backup' => 'Backup',
|
||||||
])
|
])
|
||||||
->multiple(),
|
->multiple(),
|
||||||
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Filament\Resources\HostingPlanResource\Pages;
|
namespace App\Filament\Resources\HostingPlanResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\HostingPlanResource;
|
use App\Filament\Resources\HostingPlanResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateHostingPlan extends CreateRecord
|
class CreateHostingPlan extends CreateRecord
|
||||||
|
|
|
@ -3,16 +3,12 @@
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\HostingSubscriptionResource\Pages;
|
use App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||||
use App\Filament\Resources\HostingSubscriptionResource\RelationManagers;
|
|
||||||
use App\Models\HostingSubscription;
|
use App\Models\HostingSubscription;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Components\Field;
|
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Illuminate\Support\HtmlString;
|
use Illuminate\Support\HtmlString;
|
||||||
|
|
||||||
class HostingSubscriptionResource extends Resource
|
class HostingSubscriptionResource extends Resource
|
||||||
|
@ -41,8 +37,8 @@ class HostingSubscriptionResource extends Resource
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->content(fn ($record) => new HtmlString('
|
->content(fn ($record) => new HtmlString('
|
||||||
<a href="http://' . $record->domain . '" target="_blank" class="text-sm font-medium text-primary-600 dark:text-primary-400">
|
<a href="http://'.$record->domain.'" target="_blank" class="text-sm font-medium text-primary-600 dark:text-primary-400">
|
||||||
http://' . $record->domain . '
|
http://'.$record->domain.'
|
||||||
</a>')),
|
</a>')),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('domain')
|
Forms\Components\TextInput::make('domain')
|
||||||
|
@ -56,7 +52,7 @@ class HostingSubscriptionResource extends Resource
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->suffixIcon('heroicon-m-globe-alt')
|
->suffixIcon('heroicon-m-globe-alt')
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
|
|
||||||
Forms\Components\Select::make('customer_id')
|
Forms\Components\Select::make('customer_id')
|
||||||
->label('Customer')
|
->label('Customer')
|
||||||
|
@ -94,20 +90,20 @@ class HostingSubscriptionResource extends Resource
|
||||||
})
|
})
|
||||||
->suffixIcon('heroicon-m-user'),
|
->suffixIcon('heroicon-m-user'),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('system_password')
|
Forms\Components\TextInput::make('system_password')
|
||||||
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
|
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
|
||||||
->disabled(function ($record) {
|
->disabled(function ($record) {
|
||||||
if (isset($record->exists)) {
|
if (isset($record->exists)) {
|
||||||
return $record->exists;
|
return $record->exists;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->suffixIcon('heroicon-m-lock-closed'),
|
->suffixIcon('heroicon-m-lock-closed'),
|
||||||
|
|
||||||
Forms\Components\Textarea::make('description')
|
Forms\Components\Textarea::make('description')
|
||||||
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
|
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -143,7 +139,7 @@ class HostingSubscriptionResource extends Resource
|
||||||
->label('Open website')
|
->label('Open website')
|
||||||
->icon('heroicon-m-arrow-top-right-on-square')
|
->icon('heroicon-m-arrow-top-right-on-square')
|
||||||
->color('gray')
|
->color('gray')
|
||||||
->url(fn ($record): string => 'http://' . $record->domain, true),
|
->url(fn ($record): string => 'http://'.$record->domain, true),
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
Tables\Actions\DeleteAction::make(),
|
Tables\Actions\DeleteAction::make(),
|
||||||
])
|
])
|
||||||
|
@ -165,9 +161,9 @@ class HostingSubscriptionResource extends Resource
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'index' => Pages\ManageHostingSubscriptions::route('/'),
|
'index' => Pages\ManageHostingSubscriptions::route('/'),
|
||||||
// 'index' => Pages\ListHostingSubscriptions::route('/'),
|
// 'index' => Pages\ListHostingSubscriptions::route('/'),
|
||||||
// 'create' => Pages\CreateHostingSubscription::route('/create'),
|
// 'create' => Pages\CreateHostingSubscription::route('/create'),
|
||||||
// 'edit' => Pages\EditHostingSubscription::route('/{record}/edit'),
|
// 'edit' => Pages\EditHostingSubscription::route('/{record}/edit'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,9 @@
|
||||||
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
|
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\HostingSubscriptionResource;
|
use App\Filament\Resources\HostingSubscriptionResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateHostingSubscription extends CreateRecord
|
class CreateHostingSubscription extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = HostingSubscriptionResource::class;
|
protected static string $resource = HostingSubscriptionResource::class;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
|
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||||
|
|
||||||
|
|
||||||
use App\Filament\Resources\HostingSubscriptionResource;
|
use App\Filament\Resources\HostingSubscriptionResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Resources\Pages\ManageRecords;
|
use Filament\Resources\Pages\ManageRecords;
|
||||||
|
|
|
@ -3,15 +3,12 @@
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\UserResource\Pages;
|
use App\Filament\Resources\UserResource\Pages;
|
||||||
use App\Filament\Resources\UserResource\RelationManagers;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class UserResource extends Resource
|
class UserResource extends Resource
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Filament\Resources\UserResource\Pages;
|
namespace App\Filament\Resources\UserResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\UserResource;
|
use App\Filament\Resources\UserResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateUser extends CreateRecord
|
class CreateUser extends CreateRecord
|
||||||
|
|
|
@ -16,22 +16,20 @@ class CustomersCount extends BaseWidget
|
||||||
protected function getStats(): array
|
protected function getStats(): array
|
||||||
{
|
{
|
||||||
|
|
||||||
// $serverStatistic = new \App\Statistics\ServerStatistic();
|
// $serverStatistic = new \App\Statistics\ServerStatistic();
|
||||||
// $serverStats = $serverStatistic->getCurrentStats();
|
// $serverStats = $serverStatistic->getCurrentStats();
|
||||||
|
|
||||||
|
|
||||||
$customersCount = Customer::count();
|
$customersCount = Customer::count();
|
||||||
$websiteCount = Domain::count();
|
$websiteCount = Domain::count();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Stat::make('Total Memory', $serverStats['memory']['total']),
|
// Stat::make('Total Memory', $serverStats['memory']['total']),
|
||||||
// Stat::make('Used Memory', $serverStats['memory']['used']),
|
// Stat::make('Used Memory', $serverStats['memory']['used']),
|
||||||
// Stat::make('Free Memory', $serverStats['memory']['free']),
|
// Stat::make('Free Memory', $serverStats['memory']['free']),
|
||||||
// Stat::make('Shared Memory', $serverStats['memory']['shared']),
|
// Stat::make('Shared Memory', $serverStats['memory']['shared']),
|
||||||
// Stat::make('Buffer Cache', $serverStats['memory']['buffCache']),
|
// Stat::make('Buffer Cache', $serverStats['memory']['buffCache']),
|
||||||
// Stat::make('Available Memory', $serverStats['memory']['available']),
|
// Stat::make('Available Memory', $serverStats['memory']['available']),
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
Stat::make('Websites', $websiteCount)->icon('heroicon-o-globe-alt'),
|
Stat::make('Websites', $websiteCount)->icon('heroicon-o-globe-alt'),
|
||||||
Stat::make('Customers', $customersCount)->icon('heroicon-o-users'),
|
Stat::make('Customers', $customersCount)->icon('heroicon-o-users'),
|
||||||
|
|
|
@ -8,27 +8,21 @@ class ServerDiskUsageStatistic extends ApexChartWidget
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Chart Id
|
* Chart Id
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
protected static ?string $chartId = 'serverDiskUsageStatisticChart';
|
protected static ?string $chartId = 'serverDiskUsageStatisticChart';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget Title
|
* Widget Title
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
*/
|
||||||
protected static ?string $heading = 'Disk Usage';
|
protected static ?string $heading = 'Disk Usage';
|
||||||
|
|
||||||
protected static ?int $sort = 1;
|
protected static ?int $sort = 1;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget content height
|
* Widget content height
|
||||||
*/
|
*/
|
||||||
protected static ?int $contentHeight = 100;
|
protected static ?int $contentHeight = 100;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget Footer
|
* Widget Footer
|
||||||
*/
|
*/
|
||||||
|
@ -40,7 +34,6 @@ class ServerDiskUsageStatistic extends ApexChartWidget
|
||||||
return view('charts.order-status.footer', ['data' => $serverStats]);
|
return view('charts.order-status.footer', ['data' => $serverStats]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chart options (series, labels, types, size, animations...)
|
* Chart options (series, labels, types, size, animations...)
|
||||||
* https://apexcharts.com/docs/options
|
* https://apexcharts.com/docs/options
|
||||||
|
|
|
@ -8,27 +8,21 @@ class ServerMemoryStatistic extends ApexChartWidget
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Chart Id
|
* Chart Id
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
protected static ?string $chartId = 'serverMemoryStatisticChart';
|
protected static ?string $chartId = 'serverMemoryStatisticChart';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget Title
|
* Widget Title
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
*/
|
||||||
protected static ?string $heading = 'RAM Usage';
|
protected static ?string $heading = 'RAM Usage';
|
||||||
|
|
||||||
protected static ?int $sort = 2;
|
protected static ?int $sort = 2;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget content height
|
* Widget content height
|
||||||
*/
|
*/
|
||||||
protected static ?int $contentHeight = 100;
|
protected static ?int $contentHeight = 100;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget Footer
|
* Widget Footer
|
||||||
*/
|
*/
|
||||||
|
@ -40,7 +34,6 @@ class ServerMemoryStatistic extends ApexChartWidget
|
||||||
return view('filament.widgets.server-memory-statistic', ['data' => $serverStats]);
|
return view('filament.widgets.server-memory-statistic', ['data' => $serverStats]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chart options (series, labels, types, size, animations...)
|
* Chart options (series, labels, types, size, animations...)
|
||||||
* https://apexcharts.com/docs/options
|
* https://apexcharts.com/docs/options
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
|
|
||||||
namespace App\Filament\Widgets;
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
use App\Models\Customer;
|
|
||||||
use App\Models\Domain;
|
|
||||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
|
||||||
|
|
||||||
class ServerMemoryStatisticCount extends BaseWidget
|
class ServerMemoryStatisticCount extends BaseWidget
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Filament\Widgets;
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
use App\Models\Domain;
|
use App\Models\Domain;
|
||||||
use Faker\Provider\Text;
|
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Filament\Widgets\TableWidget as BaseWidget;
|
use Filament\Widgets\TableWidget as BaseWidget;
|
||||||
|
@ -14,9 +13,9 @@ class Websites extends BaseWidget
|
||||||
|
|
||||||
protected static ?string $heading = 'Last created websites';
|
protected static ?string $heading = 'Last created websites';
|
||||||
|
|
||||||
protected int | string | array $columnSpan = 2;
|
protected int|string|array $columnSpan = 2;
|
||||||
|
|
||||||
protected static ?int $sort =5;
|
protected static ?int $sort = 5;
|
||||||
|
|
||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
|
@ -29,12 +28,12 @@ class Websites extends BaseWidget
|
||||||
->label('Open website')
|
->label('Open website')
|
||||||
->icon('heroicon-m-arrow-top-right-on-square')
|
->icon('heroicon-m-arrow-top-right-on-square')
|
||||||
->color('gray')
|
->color('gray')
|
||||||
->url(fn ($record): string => 'http://' . $record->domain, true),
|
->url(fn ($record): string => 'http://'.$record->domain, true),
|
||||||
])
|
])
|
||||||
->columns([
|
->columns([
|
||||||
Tables\Columns\TextColumn::make('domain'),
|
Tables\Columns\TextColumn::make('domain'),
|
||||||
Tables\Columns\TextColumn::make('hostingPlan.name'),
|
Tables\Columns\TextColumn::make('hostingPlan.name'),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at'),
|
||||||
])->defaultSort('id', 'desc');
|
])->defaultSort('id', 'desc');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ class FileManagerApi
|
||||||
{
|
{
|
||||||
return is_file($path);
|
return is_file($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isWritable($path)
|
public function isWritable($path)
|
||||||
{
|
{
|
||||||
return is_writable($path);
|
return is_writable($path);
|
||||||
|
@ -37,10 +38,9 @@ class FileManagerApi
|
||||||
{
|
{
|
||||||
return file_exists($file);
|
return file_exists($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filePutContents($file, $data)
|
public function filePutContents($file, $data)
|
||||||
{
|
{
|
||||||
return file_put_contents($file, $data);
|
return file_put_contents($file, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,18 @@ use App\Http\Controllers\Api\Request\CustomerCreateRequest;
|
||||||
use App\Http\Controllers\ApiController;
|
use App\Http\Controllers\ApiController;
|
||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
use App\Models\HostingSubscription;
|
use App\Models\HostingSubscription;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class CustomersController extends ApiController
|
class CustomersController extends ApiController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @OA\Get(
|
* @OA\Get(
|
||||||
* path="/api/customers",
|
* path="/api/customers",
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Successful operation",
|
* description="Successful operation",
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\PathItem (
|
* @OA\PathItem (
|
||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
|
@ -30,7 +31,7 @@ class CustomersController extends ApiController
|
||||||
'message' => 'Customers found',
|
'message' => 'Customers found',
|
||||||
'data' => [
|
'data' => [
|
||||||
'customers' => $findCustomers,
|
'customers' => $findCustomers,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,16 +39,21 @@ class CustomersController extends ApiController
|
||||||
/**
|
/**
|
||||||
* @OA\Post(
|
* @OA\Post(
|
||||||
* path="/api/customers",
|
* path="/api/customers",
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Successful operation",
|
* description="Successful operation",
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\PathItem (
|
* @OA\PathItem (
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* required={"name","email","phone"},
|
* required={"name","email","phone"},
|
||||||
|
*
|
||||||
* @OA\Property(property="name", type="string", example="John Doe", description="Name of the customer"),
|
* @OA\Property(property="name", type="string", example="John Doe", description="Name of the customer"),
|
||||||
* @OA\Property(property="email", type="string", example="jhon@gmail.com", description="Email of the customer"),
|
* @OA\Property(property="email", type="string", example="jhon@gmail.com", description="Email of the customer"),
|
||||||
* @OA\Property(property="phone", type="string", example="1234567890", description="Phone of the customer")
|
* @OA\Property(property="phone", type="string", example="1234567890", description="Phone of the customer")
|
||||||
|
@ -67,14 +73,14 @@ class CustomersController extends ApiController
|
||||||
'message' => 'Customer created',
|
'message' => 'Customer created',
|
||||||
'data' => [
|
'data' => [
|
||||||
'customer' => $customer,
|
'customer' => $customer,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHostingSubscriptionsByCustomerId($customerId)
|
public function getHostingSubscriptionsByCustomerId($customerId)
|
||||||
{
|
{
|
||||||
$findCustomer = Customer::where('id', $customerId)->first();
|
$findCustomer = Customer::where('id', $customerId)->first();
|
||||||
if (!$findCustomer) {
|
if (! $findCustomer) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
'message' => 'Customer not found',
|
'message' => 'Customer not found',
|
||||||
|
@ -94,7 +100,7 @@ class CustomersController extends ApiController
|
||||||
'message' => 'Hosting subscriptions found',
|
'message' => 'Hosting subscriptions found',
|
||||||
'data' => [
|
'data' => [
|
||||||
'hostingSubscriptions' => $findHostingSubscriptions,
|
'hostingSubscriptions' => $findHostingSubscriptions,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api;
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
|
||||||
use App\Http\Controllers\ApiController;
|
use App\Http\Controllers\ApiController;
|
||||||
use App\ShellApi;
|
|
||||||
|
|
||||||
class HealthController extends ApiController
|
class HealthController extends ApiController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @OA\Get(
|
* @OA\Get(
|
||||||
* path="/api/health",
|
* path="/api/health",
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Successful operation",
|
* description="Successful operation",
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\PathItem (
|
* @OA\PathItem (
|
||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
|
@ -23,7 +23,7 @@ class HealthController extends ApiController
|
||||||
{
|
{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'ok',
|
'status' => 'ok',
|
||||||
'message' => 'API is running.'
|
'message' => 'API is running.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,18 @@ use App\Http\Controllers\Api\Request\CustomerCreateRequest;
|
||||||
use App\Http\Controllers\ApiController;
|
use App\Http\Controllers\ApiController;
|
||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
use App\Models\HostingPlan;
|
use App\Models\HostingPlan;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class HostingPlansController extends ApiController
|
class HostingPlansController extends ApiController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @OA\Get(
|
* @OA\Get(
|
||||||
* path="/api/hosting-plans",
|
* path="/api/hosting-plans",
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Successful operation",
|
* description="Successful operation",
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\PathItem (
|
* @OA\PathItem (
|
||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
|
@ -29,8 +30,8 @@ class HostingPlansController extends ApiController
|
||||||
'status' => 'ok',
|
'status' => 'ok',
|
||||||
'message' => 'Hosting Plans found',
|
'message' => 'Hosting Plans found',
|
||||||
'data' => [
|
'data' => [
|
||||||
'hostingPlans' => $findHostingPlans->toArray()
|
'hostingPlans' => $findHostingPlans->toArray(),
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,16 +39,21 @@ class HostingPlansController extends ApiController
|
||||||
/**
|
/**
|
||||||
* @OA\Post(
|
* @OA\Post(
|
||||||
* path="/api/customers",
|
* path="/api/customers",
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Successful operation",
|
* description="Successful operation",
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\PathItem (
|
* @OA\PathItem (
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* required={"name","email","phone"},
|
* required={"name","email","phone"},
|
||||||
|
*
|
||||||
* @OA\Property(property="name", type="string", example="John Doe", description="Name of the customer"),
|
* @OA\Property(property="name", type="string", example="John Doe", description="Name of the customer"),
|
||||||
* @OA\Property(property="email", type="string", example="jhon@gmail.com", description="Email of the customer"),
|
* @OA\Property(property="email", type="string", example="jhon@gmail.com", description="Email of the customer"),
|
||||||
* @OA\Property(property="phone", type="string", example="1234567890", description="Phone of the customer")
|
* @OA\Property(property="phone", type="string", example="1234567890", description="Phone of the customer")
|
||||||
|
@ -68,7 +74,7 @@ class HostingPlansController extends ApiController
|
||||||
'message' => 'Customer created',
|
'message' => 'Customer created',
|
||||||
'data' => [
|
'data' => [
|
||||||
'customer' => $customer,
|
'customer' => $customer,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class HostingSubscriptionsController extends ApiController
|
||||||
'message' => 'Hosting subscriptions found',
|
'message' => 'Hosting subscriptions found',
|
||||||
'data' => [
|
'data' => [
|
||||||
'HostingSubscriptions' => $findHostingSubscription,
|
'HostingSubscriptions' => $findHostingSubscription,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ class HostingSubscriptionsController extends ApiController
|
||||||
$hostingSubscription->customer_id = $request->customer_id;
|
$hostingSubscription->customer_id = $request->customer_id;
|
||||||
$hostingSubscription->hosting_plan_id = $request->hosting_plan_id;
|
$hostingSubscription->hosting_plan_id = $request->hosting_plan_id;
|
||||||
$hostingSubscription->domain = $request->domain;
|
$hostingSubscription->domain = $request->domain;
|
||||||
// $hostingSubscription->username = $request->username;
|
// $hostingSubscription->username = $request->username;
|
||||||
// $hostingSubscription->password = $request->password;
|
// $hostingSubscription->password = $request->password;
|
||||||
// $hostingSubscription->description = $request->description;
|
// $hostingSubscription->description = $request->description;
|
||||||
$hostingSubscription->setup_date = Carbon::now();
|
$hostingSubscription->setup_date = Carbon::now();
|
||||||
$hostingSubscription->save();
|
$hostingSubscription->save();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class HostingSubscriptionsController extends ApiController
|
||||||
'message' => 'Hosting subscription created',
|
'message' => 'Hosting subscription created',
|
||||||
'data' => [
|
'data' => [
|
||||||
'hostingSubscription' => $hostingSubscription,
|
'hostingSubscription' => $hostingSubscription,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ class HostingSubscriptionsController extends ApiController
|
||||||
$findHostingSubscription = HostingSubscription::where('id', $id)->first();
|
$findHostingSubscription = HostingSubscription::where('id', $id)->first();
|
||||||
if ($findHostingSubscription) {
|
if ($findHostingSubscription) {
|
||||||
$findHostingSubscription->delete();
|
$findHostingSubscription->delete();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'ok',
|
'status' => 'ok',
|
||||||
'message' => 'Hosting subscription deleted',
|
'message' => 'Hosting subscription deleted',
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AuthLoginRequest extends ApiRequest
|
||||||
return [
|
return [
|
||||||
'email' => 'required|string|email',
|
'email' => 'required|string|email',
|
||||||
'password' => 'required|string',
|
'password' => 'required|string',
|
||||||
// 'browserAgent' => 'required|string',
|
// 'browserAgent' => 'required|string',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Request;
|
namespace App\Http\Controllers\Api\Request;
|
||||||
|
|
||||||
class CustomerCreateRequest extends AuthorizedApiRequest
|
class CustomerCreateRequest extends AuthorizedApiRequest
|
||||||
|
@ -12,7 +13,7 @@ class CustomerCreateRequest extends AuthorizedApiRequest
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'email' => 'required|email|unique:customers,email'
|
'email' => 'required|email|unique:customers,email',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Illuminate\Routing\Controller as BaseController;
|
||||||
* @OA\Info(
|
* @OA\Info(
|
||||||
* title="PhyrePanel - API Documentation",
|
* title="PhyrePanel - API Documentation",
|
||||||
* version="0.1",
|
* version="0.1",
|
||||||
|
*
|
||||||
* @OA\Contact(
|
* @OA\Contact(
|
||||||
* email="info@phyrepanel.com"
|
* email="info@phyrepanel.com"
|
||||||
* ),
|
* ),
|
||||||
|
@ -17,8 +18,6 @@ use Illuminate\Routing\Controller as BaseController;
|
||||||
*/
|
*/
|
||||||
class ApiController extends BaseController
|
class ApiController extends BaseController
|
||||||
{
|
{
|
||||||
// use AuthorizesRequests, ValidatesRequests;
|
// use AuthorizesRequests, ValidatesRequests;
|
||||||
use ValidatesRequests;
|
use ValidatesRequests;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,9 @@ namespace App\Listeners;
|
||||||
use App\Actions\ApacheWebsiteCreate;
|
use App\Actions\ApacheWebsiteCreate;
|
||||||
use App\Events\DomainIsCreated;
|
use App\Events\DomainIsCreated;
|
||||||
use App\Events\ModelDomainCreated;
|
use App\Events\ModelDomainCreated;
|
||||||
use App\Models\Customer;
|
|
||||||
use App\Models\Domain;
|
use App\Models\Domain;
|
||||||
use App\Models\HostingPackage;
|
|
||||||
use App\Models\HostingPlan;
|
use App\Models\HostingPlan;
|
||||||
use App\Models\HostingSubscription;
|
use App\Models\HostingSubscription;
|
||||||
use Cassandra\Custom;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use function Symfony\Component\String\u;
|
|
||||||
|
|
||||||
class ModelDomainCreatedListener
|
class ModelDomainCreatedListener
|
||||||
{
|
{
|
||||||
|
@ -32,16 +25,16 @@ class ModelDomainCreatedListener
|
||||||
public function handle(ModelDomainCreated $event): void
|
public function handle(ModelDomainCreated $event): void
|
||||||
{
|
{
|
||||||
$findDomain = Domain::where('id', $event->model->id)->first();
|
$findDomain = Domain::where('id', $event->model->id)->first();
|
||||||
if (!$findDomain) {
|
if (! $findDomain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$findHostingSubscription = HostingSubscription::where('id', $findDomain->hosting_subscription_id)->first();
|
$findHostingSubscription = HostingSubscription::where('id', $findDomain->hosting_subscription_id)->first();
|
||||||
if (!$findHostingSubscription) {
|
if (! $findHostingSubscription) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$findHostingPlan = HostingPlan::where('id', $findHostingSubscription->hosting_plan_id)->first();
|
$findHostingPlan = HostingPlan::where('id', $findHostingSubscription->hosting_plan_id)->first();
|
||||||
if (!$findHostingPlan) {
|
if (! $findHostingPlan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +47,9 @@ class ModelDomainCreatedListener
|
||||||
$newApacheWebsite->setIsMainDomain(true);
|
$newApacheWebsite->setIsMainDomain(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$create = $newApacheWebsite->handle();
|
$create = $newApacheWebsite->handle();
|
||||||
|
|
||||||
if (!empty($create)) {
|
if (! empty($create)) {
|
||||||
|
|
||||||
$findDomain->home_root = $create['homeRoot'];
|
$findDomain->home_root = $create['homeRoot'];
|
||||||
$findDomain->domain_root = $create['domainRoot'];
|
$findDomain->domain_root = $create['domainRoot'];
|
||||||
|
|
|
@ -5,8 +5,6 @@ namespace App\Listeners;
|
||||||
use App\Actions\ApacheWebsiteDelete;
|
use App\Actions\ApacheWebsiteDelete;
|
||||||
use App\Events\ModelDomainDeleting;
|
use App\Events\ModelDomainDeleting;
|
||||||
use App\ShellApi;
|
use App\ShellApi;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
|
|
||||||
class ModelDomainDeletingListener
|
class ModelDomainDeletingListener
|
||||||
{
|
{
|
||||||
|
@ -25,7 +23,7 @@ class ModelDomainDeletingListener
|
||||||
{
|
{
|
||||||
$domainRoot = '/home/'.$event->model->domain_username.'/domains/'.$event->model->domain;
|
$domainRoot = '/home/'.$event->model->domain_username.'/domains/'.$event->model->domain;
|
||||||
|
|
||||||
ShellApi::exec('rm -rf ' . $domainRoot);
|
ShellApi::exec('rm -rf '.$domainRoot);
|
||||||
|
|
||||||
$deleteApacheWebsite = new ApacheWebsiteDelete();
|
$deleteApacheWebsite = new ApacheWebsiteDelete();
|
||||||
$deleteApacheWebsite->setDomain($event->model->domain);
|
$deleteApacheWebsite->setDomain($event->model->domain);
|
||||||
|
|
|
@ -27,24 +27,24 @@ class ModelHostingSubscriptionCreatedListener
|
||||||
{
|
{
|
||||||
|
|
||||||
$findHostingSubscription = HostingSubscription::where('id', $event->model->id)->first();
|
$findHostingSubscription = HostingSubscription::where('id', $event->model->id)->first();
|
||||||
if (!$findHostingSubscription) {
|
if (! $findHostingSubscription) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$findCustomer = Customer::where('id', $event->model->customer_id)->first();
|
$findCustomer = Customer::where('id', $event->model->customer_id)->first();
|
||||||
if (!$findCustomer) {
|
if (! $findCustomer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$systemUsername = $this->_generateUsername($event->model->domain);
|
$systemUsername = $this->_generateUsername($event->model->domain);
|
||||||
$systemUsername = $systemUsername . $findCustomer->id . $findHostingSubscription->id;
|
$systemUsername = $systemUsername.$findCustomer->id.$findHostingSubscription->id;
|
||||||
|
|
||||||
$getLinuxUser = new GetLinuxUser();
|
$getLinuxUser = new GetLinuxUser();
|
||||||
$getLinuxUser->setUsername($systemUsername);
|
$getLinuxUser->setUsername($systemUsername);
|
||||||
$linuxUser = $getLinuxUser->handle();
|
$linuxUser = $getLinuxUser->handle();
|
||||||
|
|
||||||
if (!empty($linuxUser)) {
|
if (! empty($linuxUser)) {
|
||||||
$systemUsername = $this->_generateUsername(Str::random(10));
|
$systemUsername = $this->_generateUsername(Str::random(10));
|
||||||
$systemUsername = $systemUsername . $findCustomer->id . $findHostingSubscription->id;
|
$systemUsername = $systemUsername.$findCustomer->id.$findHostingSubscription->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$systemPassword = Str::random(14);
|
$systemPassword = Str::random(14);
|
||||||
|
@ -75,13 +75,13 @@ class ModelHostingSubscriptionCreatedListener
|
||||||
$removedMultispace = preg_replace('/\s+/', ' ', $string);
|
$removedMultispace = preg_replace('/\s+/', ' ', $string);
|
||||||
$sanitized = preg_replace('/[^A-Za-z0-9\ ]/', '', $removedMultispace);
|
$sanitized = preg_replace('/[^A-Za-z0-9\ ]/', '', $removedMultispace);
|
||||||
$lowercased = strtolower($sanitized);
|
$lowercased = strtolower($sanitized);
|
||||||
$lowercased = str_replace(" ", "", $lowercased);
|
$lowercased = str_replace(' ', '', $lowercased);
|
||||||
$lowercased = trim($lowercased);
|
$lowercased = trim($lowercased);
|
||||||
if (strlen($lowercased) > 10) {
|
if (strlen($lowercased) > 10) {
|
||||||
$lowercased = substr($lowercased, 0, 10);
|
$lowercased = substr($lowercased, 0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
$username = $lowercased . rand(1111,9999) . Str::random(4);
|
$username = $lowercased.rand(1111, 9999).Str::random(4);
|
||||||
$username = strtolower($username);
|
$username = strtolower($username);
|
||||||
|
|
||||||
return $username;
|
return $username;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Listeners;
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\Actions\GetLinuxUser;
|
use App\Actions\GetLinuxUser;
|
||||||
use App\Events\ModelHostingSubscriptionCreated;
|
|
||||||
use App\Events\ModelHostingSubscriptionDeleting;
|
use App\Events\ModelHostingSubscriptionDeleting;
|
||||||
use App\Models\Domain;
|
use App\Models\Domain;
|
||||||
|
|
||||||
|
@ -26,9 +25,9 @@ class ModelHostingSubscriptionDeletingListener
|
||||||
$getLinuxUser->setUsername($event->model->system_username);
|
$getLinuxUser->setUsername($event->model->system_username);
|
||||||
$getLinuxUserStatus = $getLinuxUser->handle();
|
$getLinuxUserStatus = $getLinuxUser->handle();
|
||||||
|
|
||||||
if (!empty($getLinuxUserStatus)) {
|
if (! empty($getLinuxUserStatus)) {
|
||||||
shell_exec('userdel ' . $event->model->system_username);
|
shell_exec('userdel '.$event->model->system_username);
|
||||||
shell_exec('rm -rf /home/' . $event->model->system_username);
|
shell_exec('rm -rf /home/'.$event->model->system_username);
|
||||||
}
|
}
|
||||||
$findRelatedDomains = Domain::where('hosting_subscription_id', $event->model->id)->get();
|
$findRelatedDomains = Domain::where('hosting_subscription_id', $event->model->id)->get();
|
||||||
if ($findRelatedDomains->count() > 0) {
|
if ($findRelatedDomains->count() > 0) {
|
||||||
|
@ -38,5 +37,4 @@ class ModelHostingSubscriptionDeletingListener
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Installer extends Component
|
class Installer extends Component
|
||||||
|
@ -11,8 +10,11 @@ class Installer extends Component
|
||||||
public $step = 1;
|
public $step = 1;
|
||||||
|
|
||||||
public $name;
|
public $name;
|
||||||
|
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
public $password;
|
public $password;
|
||||||
|
|
||||||
public $password_confirmation;
|
public $password_confirmation;
|
||||||
|
|
||||||
public function install()
|
public function install()
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Sushi\Sushi;
|
use Sushi\Sushi;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\ShellApi;
|
use App\ShellApi;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Sushi\Sushi;
|
use Sushi\Sushi;
|
||||||
|
|
||||||
|
@ -64,20 +63,20 @@ class CronJob extends Model
|
||||||
$user = ShellApi::exec('whoami');
|
$user = ShellApi::exec('whoami');
|
||||||
|
|
||||||
$cronList = ShellApi::callBin('cron-jobs-list', [
|
$cronList = ShellApi::callBin('cron-jobs-list', [
|
||||||
$user
|
$user,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rows = [];
|
$rows = [];
|
||||||
if (!empty($cronList)) {
|
if (! empty($cronList)) {
|
||||||
$cronList = json_decode($cronList, true);
|
$cronList = json_decode($cronList, true);
|
||||||
if (!empty($cronList)) {
|
if (! empty($cronList)) {
|
||||||
foreach ($cronList as $cron) {
|
foreach ($cronList as $cron) {
|
||||||
if (isset($cron['schedule'])) {
|
if (isset($cron['schedule'])) {
|
||||||
$rows[] = [
|
$rows[] = [
|
||||||
'schedule' => $cron['schedule'],
|
'schedule' => $cron['schedule'],
|
||||||
'command' => $cron['command'],
|
'command' => $cron['command'],
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'time'=> time(),
|
'time' => time(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Models;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
|
||||||
class Customer extends Model
|
class Customer extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
@ -28,5 +27,4 @@ class Customer extends Model
|
||||||
{
|
{
|
||||||
return $this->hasMany(HostingSubscription::class);
|
return $this->hasMany(HostingSubscription::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ namespace App\Models;
|
||||||
|
|
||||||
use App\Events\ModelDomainCreated;
|
use App\Events\ModelDomainCreated;
|
||||||
use App\Events\ModelDomainDeleting;
|
use App\Events\ModelDomainDeleting;
|
||||||
use App\ShellApi;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Domain extends Model
|
class Domain extends Model
|
||||||
|
@ -30,5 +28,4 @@ class Domain extends Model
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,4 @@ class DomainSslCertificate extends Model
|
||||||
'renewed_date',
|
'renewed_date',
|
||||||
'renewed_until_date',
|
'renewed_until_date',
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class HostingDatabase extends Model
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'database_name',
|
'database_name',
|
||||||
'database_username',
|
'database_username',
|
||||||
'database_password'
|
'database_password',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function boot()
|
public static function boot()
|
||||||
|
@ -22,7 +22,7 @@ class HostingDatabase extends Model
|
||||||
$createDbAndUser = ShellApi::callBin('mysql-create-db-and-user', [
|
$createDbAndUser = ShellApi::callBin('mysql-create-db-and-user', [
|
||||||
$model->database_name,
|
$model->database_name,
|
||||||
$model->database_username,
|
$model->database_username,
|
||||||
$model->database_password
|
$model->database_password,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (empty($createDbAndUser)) {
|
if (empty($createDbAndUser)) {
|
||||||
|
@ -35,5 +35,4 @@ class HostingDatabase extends Model
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,5 +34,4 @@ class HostingPlan extends Model
|
||||||
'features' => 'array',
|
'features' => 'array',
|
||||||
'limitations' => 'array',
|
'limitations' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class HostingSubscription extends Model
|
||||||
'description',
|
'description',
|
||||||
'setup_date',
|
'setup_date',
|
||||||
'expiry_date',
|
'expiry_date',
|
||||||
'renewal_date'
|
'renewal_date',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function boot()
|
public static function boot()
|
||||||
|
@ -44,5 +44,4 @@ class HostingSubscription extends Model
|
||||||
{
|
{
|
||||||
return $this->belongsTo(HostingPlan::class);
|
return $this->belongsTo(HostingPlan::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ use Rappasoft\LaravelAuthenticationLog\Traits\AuthenticationLoggable;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use HasApiTokens, HasFactory, Notifiable, AuthenticationLoggable;
|
use AuthenticationLoggable, HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
|
|
|
@ -8,7 +8,6 @@ use Illuminate\Foundation\Application;
|
||||||
* @property \App\FileManagerApi $file_manager_api
|
* @property \App\FileManagerApi $file_manager_api
|
||||||
* @property \App\VirtualHosts\ApacheVirtualHostManager $virtualHostManager
|
* @property \App\VirtualHosts\ApacheVirtualHostManager $virtualHostManager
|
||||||
*/
|
*/
|
||||||
class PhyreLaravelApplication extends Application {
|
class PhyreLaravelApplication extends Application
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace App\Policies;
|
namespace App\Policies;
|
||||||
|
|
||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
use App\Models\User;
|
|
||||||
use App\Models\Domain;
|
use App\Models\Domain;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Auth\Access\Response;
|
use Illuminate\Auth\Access\Response;
|
||||||
|
|
||||||
class CustomerPolicy
|
class CustomerPolicy
|
||||||
|
@ -12,7 +12,7 @@ class CustomerPolicy
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can view any models.
|
* Determine whether the user can view any models.
|
||||||
*/
|
*/
|
||||||
public function viewAny(User $user) : bool
|
public function viewAny(User $user): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class CustomerPolicy
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can view the model.
|
* Determine whether the user can view the model.
|
||||||
*/
|
*/
|
||||||
public function view(User $user, Customer $customer) : bool
|
public function view(User $user, Customer $customer): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class CustomerPolicy
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can create models.
|
* Determine whether the user can create models.
|
||||||
*/
|
*/
|
||||||
public function create(User $user) : bool
|
public function create(User $user): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class CustomerPolicy
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can update the model.
|
* Determine whether the user can update the model.
|
||||||
*/
|
*/
|
||||||
public function update(User $user, Customer $customer) : bool
|
public function update(User $user, Customer $customer): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class CustomerPolicy
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can delete the model.
|
* Determine whether the user can delete the model.
|
||||||
*/
|
*/
|
||||||
public function delete(User $user, Customer $customer) : bool
|
public function delete(User $user, Customer $customer): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class CustomerPolicy
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can restore the model.
|
* Determine whether the user can restore the model.
|
||||||
*/
|
*/
|
||||||
public function restore(User $user, Customer $customer) : bool
|
public function restore(User $user, Customer $customer): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,15 @@ class CustomerPolicy
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can permanently delete the model.
|
* Determine whether the user can permanently delete the model.
|
||||||
*/
|
*/
|
||||||
public function forceDelete(User $user, Customer $customer) : bool
|
public function forceDelete(User $user, Customer $customer): bool
|
||||||
{
|
{
|
||||||
$findWebsites = Domain::where('customer_id', $customer->id)->count();
|
$findWebsites = Domain::where('customer_id', $customer->id)->count();
|
||||||
if ($findWebsites > 0) {
|
if ($findWebsites > 0) {
|
||||||
Response::deny('Customer has websites, please delete them first.');
|
Response::deny('Customer has websites, please delete them first.');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,14 @@
|
||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
|
||||||
use App\Events\ModelHostingSubscriptionCreated;
|
|
||||||
use App\Events\ModelHostingSubscriptionDeleting;
|
|
||||||
|
|
||||||
use App\Listeners\ModelHostingSubscriptionCreatedListener;
|
|
||||||
use App\Listeners\ModelHostingSubscriptionDeletingListener;
|
|
||||||
|
|
||||||
use App\Events\ModelDomainCreated;
|
use App\Events\ModelDomainCreated;
|
||||||
use App\Events\ModelDomainDeleting;
|
use App\Events\ModelDomainDeleting;
|
||||||
|
use App\Events\ModelHostingSubscriptionCreated;
|
||||||
|
use App\Events\ModelHostingSubscriptionDeleting;
|
||||||
use App\Listeners\ModelDomainCreatedListener;
|
use App\Listeners\ModelDomainCreatedListener;
|
||||||
use App\Listeners\ModelDomainDeletingListener;
|
use App\Listeners\ModelDomainDeletingListener;
|
||||||
|
use App\Listeners\ModelHostingSubscriptionCreatedListener;
|
||||||
|
use App\Listeners\ModelHostingSubscriptionDeletingListener;
|
||||||
use App\Policies\CustomerPolicy;
|
use App\Policies\CustomerPolicy;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
|
@ -49,10 +45,10 @@ class AppServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
Gate::define('delete-customer', [CustomerPolicy::class, 'delete']);
|
Gate::define('delete-customer', [CustomerPolicy::class, 'delete']);
|
||||||
|
|
||||||
Event::listen(ModelDomainCreated::class,ModelDomainCreatedListener::class);
|
Event::listen(ModelDomainCreated::class, ModelDomainCreatedListener::class);
|
||||||
Event::listen(ModelDomainDeleting::class,ModelDomainDeletingListener::class);
|
Event::listen(ModelDomainDeleting::class, ModelDomainDeletingListener::class);
|
||||||
|
|
||||||
Event::listen(ModelHostingSubscriptionCreated::class,ModelHostingSubscriptionCreatedListener::class);
|
Event::listen(ModelHostingSubscriptionCreated::class, ModelHostingSubscriptionCreatedListener::class);
|
||||||
Event::listen(ModelHostingSubscriptionDeleting::class,ModelHostingSubscriptionDeletingListener::class);
|
Event::listen(ModelHostingSubscriptionDeleting::class, ModelHostingSubscriptionDeletingListener::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class AdminPanelProvider extends PanelProvider
|
||||||
->brandLogo(asset('images/phyre-logo.svg'))
|
->brandLogo(asset('images/phyre-logo.svg'))
|
||||||
->brandLogoHeight('2.4rem')
|
->brandLogoHeight('2.4rem')
|
||||||
->colors([
|
->colors([
|
||||||
Color::Yellow
|
Color::Yellow,
|
||||||
])
|
])
|
||||||
// ->colors([
|
// ->colors([
|
||||||
// 'primary' => [
|
// 'primary' => [
|
||||||
|
@ -67,27 +67,27 @@ class AdminPanelProvider extends PanelProvider
|
||||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
||||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||||
|
|
||||||
->discoverClusters(in: module_path('Microweber', 'Filament/Clusters'), for: "Modules\\Microweber\\Filament\\Clusters")
|
->discoverClusters(in: module_path('Microweber', 'Filament/Clusters'), for: 'Modules\\Microweber\\Filament\\Clusters')
|
||||||
|
|
||||||
->pages([
|
->pages([
|
||||||
Pages\Dashboard::class,
|
Pages\Dashboard::class,
|
||||||
])
|
])
|
||||||
->plugins([
|
->plugins([
|
||||||
// FilamentAuthenticationLogPlugin::make(),
|
// FilamentAuthenticationLogPlugin::make(),
|
||||||
FilamentApexChartsPlugin::make(),
|
FilamentApexChartsPlugin::make(),
|
||||||
FilamentSettingsPlugin::make()->pages([
|
FilamentSettingsPlugin::make()->pages([
|
||||||
Settings::class,
|
Settings::class,
|
||||||
])
|
]),
|
||||||
])
|
])
|
||||||
// ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
// ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||||
->widgets([
|
->widgets([
|
||||||
ServerDiskUsageStatistic::class,
|
ServerDiskUsageStatistic::class,
|
||||||
ServerMemoryStatistic::class,
|
ServerMemoryStatistic::class,
|
||||||
// ServerMemoryStatisticCount::class,
|
// ServerMemoryStatisticCount::class,
|
||||||
CustomersCount::class,
|
CustomersCount::class,
|
||||||
Websites::class,
|
Websites::class,
|
||||||
// Widgets\AccountWidget::class,
|
// Widgets\AccountWidget::class,
|
||||||
// Widgets\FilamentInfoWidget::class,
|
// Widgets\FilamentInfoWidget::class,
|
||||||
])
|
])
|
||||||
->middleware([
|
->middleware([
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Settings
|
||||||
public static function general()
|
public static function general()
|
||||||
{
|
{
|
||||||
$settings = setting('general');
|
$settings = setting('general');
|
||||||
if (!empty($settings)) {
|
if (! empty($settings)) {
|
||||||
foreach ($settings as $key => $value) {
|
foreach ($settings as $key => $value) {
|
||||||
if (isset(self::$general[$key])) {
|
if (isset(self::$general[$key])) {
|
||||||
self::$general[$key] = $value;
|
self::$general[$key] = $value;
|
||||||
|
@ -26,5 +26,4 @@ class Settings
|
||||||
|
|
||||||
return self::$general;
|
return self::$general;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,16 @@ class ShellApi
|
||||||
public static function exec($command, $argsArray = [])
|
public static function exec($command, $argsArray = [])
|
||||||
{
|
{
|
||||||
$args = '';
|
$args = '';
|
||||||
if (!empty($argsArray)) {
|
if (! empty($argsArray)) {
|
||||||
foreach ($argsArray as $arg) {
|
foreach ($argsArray as $arg) {
|
||||||
$args .= escapeshellarg($arg) . ' ';
|
$args .= escapeshellarg($arg).' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fullCommand = $command . ' ' . $args;
|
$fullCommand = $command.' '.$args;
|
||||||
|
|
||||||
// Run the command as sudo "/usr/bin/sudo "
|
// Run the command as sudo "/usr/bin/sudo "
|
||||||
$execOutput = shell_exec("/usr/bin/sudo " . $fullCommand);
|
$execOutput = shell_exec('/usr/bin/sudo '.$fullCommand);
|
||||||
$execOutput = str_replace(PHP_EOL, '', $execOutput);
|
$execOutput = str_replace(PHP_EOL, '', $execOutput);
|
||||||
|
|
||||||
return $execOutput;
|
return $execOutput;
|
||||||
|
@ -25,14 +25,14 @@ class ShellApi
|
||||||
public static function callBin($command, $argsArray = [])
|
public static function callBin($command, $argsArray = [])
|
||||||
{
|
{
|
||||||
$args = '';
|
$args = '';
|
||||||
if (!empty($argsArray)) {
|
if (! empty($argsArray)) {
|
||||||
foreach ($argsArray as $arg) {
|
foreach ($argsArray as $arg) {
|
||||||
$args .= escapeshellarg($arg) . ' ';
|
$args .= escapeshellarg($arg).' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fullCommand = escapeshellarg('/usr/local/phyre/bin/' . $command . '.sh') . ' ' . $args;
|
$fullCommand = escapeshellarg('/usr/local/phyre/bin/'.$command.'.sh').' '.$args;
|
||||||
$commandAsSudo = '/usr/bin/sudo ' . $fullCommand;
|
$commandAsSudo = '/usr/bin/sudo '.$fullCommand;
|
||||||
|
|
||||||
$execOutput = shell_exec($commandAsSudo);
|
$execOutput = shell_exec($commandAsSudo);
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,17 @@
|
||||||
|
|
||||||
namespace App\Statistics;
|
namespace App\Statistics;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
|
|
||||||
class ServerStatistic
|
class ServerStatistic
|
||||||
{
|
{
|
||||||
public function getCurrentStats()
|
public function getCurrentStats()
|
||||||
{
|
{
|
||||||
$memory =[
|
$memory = [
|
||||||
'total' => 0,
|
'total' => 0,
|
||||||
'used' => 0,
|
'used' => 0,
|
||||||
'free' => 0,
|
'free' => 0,
|
||||||
'shared' => 0,
|
'shared' => 0,
|
||||||
'buffCache' => 0,
|
'buffCache' => 0,
|
||||||
'available' => 0
|
'available' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
$freeMemoryExec = shell_exec('free -m | grep Mem | awk \'{print $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7}\'');
|
$freeMemoryExec = shell_exec('free -m | grep Mem | awk \'{print $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7}\'');
|
||||||
|
@ -52,16 +50,16 @@ class ServerStatistic
|
||||||
'used' => 0,
|
'used' => 0,
|
||||||
'free' => 0,
|
'free' => 0,
|
||||||
'usedPercentage' => 0,
|
'usedPercentage' => 0,
|
||||||
'mountedOn' => ''
|
'mountedOn' => '',
|
||||||
];
|
];
|
||||||
if (isset($diskMemoryExp[0])) {
|
if (isset($diskMemoryExp[0])) {
|
||||||
$diskMemory['total'] = $diskMemoryExp[0]. 'B';
|
$diskMemory['total'] = $diskMemoryExp[0].'B';
|
||||||
}
|
}
|
||||||
if (isset($diskMemoryExp[1])) {
|
if (isset($diskMemoryExp[1])) {
|
||||||
$diskMemory['used'] = $diskMemoryExp[1]. 'B';
|
$diskMemory['used'] = $diskMemoryExp[1].'B';
|
||||||
}
|
}
|
||||||
if (isset($diskMemoryExp[2])) {
|
if (isset($diskMemoryExp[2])) {
|
||||||
$diskMemory['free'] = $diskMemoryExp[2]. 'B';
|
$diskMemory['free'] = $diskMemoryExp[2].'B';
|
||||||
}
|
}
|
||||||
if (isset($diskMemoryExp[3])) {
|
if (isset($diskMemoryExp[3])) {
|
||||||
$diskMemory['usedPercentage'] = $diskMemoryExp[3];
|
$diskMemory['usedPercentage'] = $diskMemoryExp[3];
|
||||||
|
@ -70,7 +68,7 @@ class ServerStatistic
|
||||||
$cpuLoad = [
|
$cpuLoad = [
|
||||||
'1min' => 0,
|
'1min' => 0,
|
||||||
'5min' => 0,
|
'5min' => 0,
|
||||||
'15min' => 0
|
'15min' => 0,
|
||||||
];
|
];
|
||||||
$cpuLoadExec = shell_exec('uptime');
|
$cpuLoadExec = shell_exec('uptime');
|
||||||
$cpuLoadExp = explode('load average:', $cpuLoadExec);
|
$cpuLoadExp = explode('load average:', $cpuLoadExec);
|
||||||
|
@ -98,28 +96,26 @@ class ServerStatistic
|
||||||
'disk' => $diskMemory,
|
'disk' => $diskMemory,
|
||||||
'cpu' => $cpuLoad,
|
'cpu' => $cpuLoad,
|
||||||
'totalTasks' => $totalTasks,
|
'totalTasks' => $totalTasks,
|
||||||
'uptime' => $uptime
|
'uptime' => $uptime,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormattedFileSize($size, $precision) {
|
public function getFormattedFileSize($size, $precision)
|
||||||
switch (true)
|
{
|
||||||
{
|
switch (true) {
|
||||||
case ($size/1024 < 1):
|
case $size / 1024 < 1:
|
||||||
return $size.'B';
|
return $size.'B';
|
||||||
case ($size/pow(1024, 2) < 1):
|
case $size / pow(1024, 2) < 1:
|
||||||
return round($size/1024, $precision).'KB';
|
return round($size / 1024, $precision).'KB';
|
||||||
case ($size/pow(1024, 3) < 1):
|
case $size / pow(1024, 3) < 1:
|
||||||
return round($size/pow(1024, 2), $precision).'MB';
|
return round($size / pow(1024, 2), $precision).'MB';
|
||||||
case ($size/pow(1024, 4) < 1):
|
case $size / pow(1024, 4) < 1:
|
||||||
return round($size/pow(1024, 3), $precision).'GB';
|
return round($size / pow(1024, 3), $precision).'GB';
|
||||||
case ($size/pow(1024, 5) < 1):
|
case $size / pow(1024, 5) < 1:
|
||||||
return round($size/pow(1024, 4), $precision).'TB';
|
return round($size / pow(1024, 4), $precision).'TB';
|
||||||
default:
|
default:
|
||||||
return 'Error: invalid input or file is too large.';
|
return 'Error: invalid input or file is too large.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,4 @@ abstract class ApacheVirtualHostConfigBase
|
||||||
|
|
||||||
return $configValues;
|
return $configValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,16 +15,16 @@ class ApacheVirtualHostManager
|
||||||
{
|
{
|
||||||
$allConfigs = [];
|
$allConfigs = [];
|
||||||
foreach ($this->registerConfigs as $module => $configs) {
|
foreach ($this->registerConfigs as $module => $configs) {
|
||||||
if (!in_array($module, $forModules)) {
|
if (! in_array($module, $forModules)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($configs as $config) {
|
foreach ($configs as $config) {
|
||||||
try {
|
try {
|
||||||
$registerConfigInstance = app()->make($config);
|
$registerConfigInstance = app()->make($config);
|
||||||
$getConfig = $registerConfigInstance->getConfig();
|
$getConfig = $registerConfigInstance->getConfig();
|
||||||
if (!empty($getConfig)) {
|
if (! empty($getConfig)) {
|
||||||
foreach ($getConfig as $key => $value) {
|
foreach ($getConfig as $key => $value) {
|
||||||
if (!isset($allConfigs[$key])) {
|
if (! isset($allConfigs[$key])) {
|
||||||
$allConfigs[$key] = [];
|
$allConfigs[$key] = [];
|
||||||
}
|
}
|
||||||
$allConfigs[$key] = array_merge($allConfigs[$key], $value);
|
$allConfigs[$key] = array_merge($allConfigs[$key], $value);
|
||||||
|
@ -38,5 +38,4 @@ class ApacheVirtualHostManager
|
||||||
|
|
||||||
return $allConfigs;
|
return $allConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.9.1",
|
"fakerphp/faker": "^1.9.1",
|
||||||
"laravel/pint": "^1.0",
|
"laravel/pint": "^1.15",
|
||||||
"laravel/sail": "^1.18",
|
"laravel/sail": "^1.18",
|
||||||
"mockery/mockery": "^1.4.4",
|
"mockery/mockery": "^1.4.4",
|
||||||
"nunomaduro/collision": "^7.0",
|
"nunomaduro/collision": "^7.0",
|
||||||
|
|
2
web/composer.lock
generated
2
web/composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "bb37d9fbda9151cc830ea85df5e6d431",
|
"content-hash": "4abe345fdbef63cc6393bf28582dc8cf",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "acmephp/core",
|
"name": "acmephp/core",
|
||||||
|
|
|
@ -35,13 +35,13 @@ return [
|
||||||
|
|
||||||
'connections' => [
|
'connections' => [
|
||||||
|
|
||||||
// 'sqlite' => [
|
// 'sqlite' => [
|
||||||
// 'driver' => 'sqlite',
|
// 'driver' => 'sqlite',
|
||||||
// 'url' => env('DATABASE_URL'),
|
// 'url' => env('DATABASE_URL'),
|
||||||
// 'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
// 'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||||
// 'prefix' => '',
|
// 'prefix' => '',
|
||||||
// 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
// 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
// ],
|
// ],
|
||||||
|
|
||||||
'sqlite' => [
|
'sqlite' => [
|
||||||
'driver' => 'sqlite',
|
'driver' => 'sqlite',
|
||||||
|
|
|
@ -4,45 +4,45 @@ return [
|
||||||
|
|
||||||
'notifications' => [
|
'notifications' => [
|
||||||
|
|
||||||
// 'new-device' => [
|
// 'new-device' => [
|
||||||
//
|
//
|
||||||
// // Send the NewDevice notification
|
// // Send the NewDevice notification
|
||||||
//
|
//
|
||||||
// 'enabled' => env('NEW_DEVICE_NOTIFICATION', true),
|
// 'enabled' => env('NEW_DEVICE_NOTIFICATION', true),
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// // Use torann/geoip to attempt to get a location
|
// // Use torann/geoip to attempt to get a location
|
||||||
//
|
//
|
||||||
// 'location' => true,
|
// 'location' => true,
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// // The Notification class to send
|
// // The Notification class to send
|
||||||
//
|
//
|
||||||
// 'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\NewDevice::class,
|
// 'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\NewDevice::class,
|
||||||
//
|
//
|
||||||
// ],
|
// ],
|
||||||
//
|
//
|
||||||
// 'failed-login' => [
|
// 'failed-login' => [
|
||||||
//
|
//
|
||||||
// // Send the FailedLogin notification
|
// // Send the FailedLogin notification
|
||||||
//
|
//
|
||||||
// 'enabled' => env('FAILED_LOGIN_NOTIFICATION', false),
|
// 'enabled' => env('FAILED_LOGIN_NOTIFICATION', false),
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// // Use torann/geoip to attempt to get a location
|
// // Use torann/geoip to attempt to get a location
|
||||||
//
|
//
|
||||||
// 'location' => true,
|
// 'location' => true,
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// // The Notification class to send
|
// // The Notification class to send
|
||||||
//
|
//
|
||||||
// 'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\FailedLogin::class,
|
// 'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\FailedLogin::class,
|
||||||
//
|
//
|
||||||
// ],
|
// ],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ return new class extends Migration
|
||||||
$table->longText('private_key')->nullable();
|
$table->longText('private_key')->nullable();
|
||||||
$table->longText('certificate_chain')->nullable();
|
$table->longText('certificate_chain')->nullable();
|
||||||
|
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class DatabaseSeeder extends Seeder
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$findHostingPlan = HostingPlan::where('slug', 'free')->first();
|
$findHostingPlan = HostingPlan::where('slug', 'free')->first();
|
||||||
if (!$findHostingPlan) {
|
if (! $findHostingPlan) {
|
||||||
HostingPlan::create([
|
HostingPlan::create([
|
||||||
'name' => 'Hosting Free',
|
'name' => 'Hosting Free',
|
||||||
'slug' => 'free',
|
'slug' => 'free',
|
||||||
|
@ -37,7 +37,7 @@ class DatabaseSeeder extends Seeder
|
||||||
}
|
}
|
||||||
|
|
||||||
$findHostingPlan = HostingPlan::where('slug', 'basic')->first();
|
$findHostingPlan = HostingPlan::where('slug', 'basic')->first();
|
||||||
if (!$findHostingPlan) {
|
if (! $findHostingPlan) {
|
||||||
HostingPlan::create([
|
HostingPlan::create([
|
||||||
'name' => 'Hosting Basic',
|
'name' => 'Hosting Basic',
|
||||||
'slug' => 'basic',
|
'slug' => 'basic',
|
||||||
|
@ -60,7 +60,7 @@ class DatabaseSeeder extends Seeder
|
||||||
}
|
}
|
||||||
|
|
||||||
$findHostingPlan = HostingPlan::where('slug', 'pro')->first();
|
$findHostingPlan = HostingPlan::where('slug', 'pro')->first();
|
||||||
if (!$findHostingPlan) {
|
if (! $findHostingPlan) {
|
||||||
HostingPlan::create([
|
HostingPlan::create([
|
||||||
'name' => 'Hosting Pro',
|
'name' => 'Hosting Pro',
|
||||||
'slug' => 'pro',
|
'slug' => 'pro',
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue