From e788c4f49a936b0221eef66bd3aaf796f51781b6 Mon Sep 17 00:00:00 2001 From: Bozhidar Slaveykov Date: Mon, 27 Nov 2023 23:22:23 +0200 Subject: [PATCH] update --- web/app/Filament/Resources/WebsiteResource.php | 14 +++++++++----- web/app/Models/Website.php | 10 +++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/web/app/Filament/Resources/WebsiteResource.php b/web/app/Filament/Resources/WebsiteResource.php index 3c7daa2..b67b3b1 100644 --- a/web/app/Filament/Resources/WebsiteResource.php +++ b/web/app/Filament/Resources/WebsiteResource.php @@ -12,6 +12,7 @@ use Filament\Tables; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; +use Illuminate\Support\Str; class WebsiteResource extends Resource { @@ -25,11 +26,14 @@ class WebsiteResource extends Resource { return $form ->schema([ - Forms\Components\TextInput::make('server_name') - ->autofocus() + + Forms\Components\TextInput::make('domain') ->required() - ->unique() - ->placeholder('example.com'), + ->suffixIcon('heroicon-m-globe-alt'), + + Forms\Components\TextInput::make('root') + ->default('/'), + ]); } @@ -37,7 +41,7 @@ class WebsiteResource extends Resource { return $table ->columns([ - Tables\Columns\TextColumn::make('server_name') + Tables\Columns\TextColumn::make('domain') ->searchable() ->sortable(), Tables\Columns\TextColumn::make('root') diff --git a/web/app/Models/Website.php b/web/app/Models/Website.php index d95c96e..db1efa7 100644 --- a/web/app/Models/Website.php +++ b/web/app/Models/Website.php @@ -13,13 +13,13 @@ class Website extends Model protected $fillable = [ 'file', - 'server_name', + 'domain', 'root' ]; protected $schema = [ 'file' => 'string', - 'server_name' => 'string', + 'domain' => 'string', 'root' => 'string' ]; @@ -30,7 +30,7 @@ class Website extends Model static::creating(function ($model) { $createWebsite = ShellApi::callBin('website-create', [ - $model->server_name, + $model->domain, 'bobkata' ]); @@ -42,7 +42,7 @@ class Website extends Model static::deleting(function ($model) { $deleteWebsite = ShellApi::callBin('website-delete', [ - $model->server_name + $model->domain ]); if (empty($deleteWebsite)) { return false; @@ -67,7 +67,7 @@ class Website extends Model if (isset($website['file'])) { $rows[] = [ 'file' => $website['file'], - 'server_name' => $website['server_name'], + 'domain' => $website['server_name'], 'root' => $website['root'] ]; }