update
This commit is contained in:
parent
2d941960f4
commit
1848d65a03
3 changed files with 42 additions and 6 deletions
|
@ -4,6 +4,7 @@ namespace App\Filament\Resources;
|
|||
|
||||
use App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||
use App\Models\HostingSubscription;
|
||||
use App\Models\PhyreServer;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
|
@ -113,6 +114,21 @@ class HostingSubscriptionResource extends Resource
|
|||
return $table
|
||||
->columns([
|
||||
|
||||
Tables\Columns\TextColumn::make('phyre_server_id')
|
||||
->label('Server')
|
||||
->badge()
|
||||
->state(function ($record) {
|
||||
if ($record->phyre_server_id > 0) {
|
||||
$phyreServer = PhyreServer::where('id', $record->phyre_server_id)->first();
|
||||
if ($phyreServer) {
|
||||
return $phyreServer->name;
|
||||
}
|
||||
}
|
||||
return 'MAIN';
|
||||
})
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
Tables\Columns\TextColumn::make('domain')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
@ -125,9 +141,9 @@ class HostingSubscriptionResource extends Resource
|
|||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
Tables\Columns\TextColumn::make('hostingPlan.name')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
// Tables\Columns\TextColumn::make('hostingPlan.name')
|
||||
// ->searchable()
|
||||
// ->sortable(),
|
||||
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\Domain;
|
||||
use App\Models\HostingSubscription;
|
||||
use App\Models\PhyreServer;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Widgets\TableWidget as BaseWidget;
|
||||
|
@ -21,7 +23,7 @@ class Websites extends BaseWidget
|
|||
{
|
||||
return $table
|
||||
->query(
|
||||
Domain::query()
|
||||
HostingSubscription::query()
|
||||
)
|
||||
->actions([
|
||||
Tables\Actions\Action::make('visit')
|
||||
|
@ -31,6 +33,22 @@ class Websites extends BaseWidget
|
|||
->url(fn ($record): string => 'http://'.$record->domain, true),
|
||||
])
|
||||
->columns([
|
||||
|
||||
Tables\Columns\TextColumn::make('phyre_server_id')
|
||||
->label('Server')
|
||||
->badge()
|
||||
->state(function ($record) {
|
||||
if ($record->phyre_server_id > 0) {
|
||||
$phyreServer = PhyreServer::where('id', $record->phyre_server_id)->first();
|
||||
if ($phyreServer) {
|
||||
return $phyreServer->name;
|
||||
}
|
||||
}
|
||||
return 'MAIN';
|
||||
})
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
Tables\Columns\TextColumn::make('domain'),
|
||||
// Tables\Columns\TextColumn::make('hostingPlan.name'),
|
||||
Tables\Columns\TextColumn::make('created_at'),
|
||||
|
|
|
@ -105,7 +105,7 @@ class PhyreServer extends Model
|
|||
$findHostingSubscription->phyre_server_id = $this->id;
|
||||
$findHostingSubscription->external_id = $phyreServerHostingSubscription['id'];
|
||||
}
|
||||
|
||||
|
||||
$findHostingSubscriptionCustomer = Customer::where('external_id', $phyreServerHostingSubscription['customer_id'])
|
||||
->where('phyre_server_id', $this->id)
|
||||
->first();
|
||||
|
@ -113,10 +113,12 @@ class PhyreServer extends Model
|
|||
$findHostingSubscription->customer_id = $findHostingSubscriptionCustomer->id;
|
||||
}
|
||||
|
||||
$findHostingSubscription->system_username = $phyreServerHostingSubscription['system_username'];
|
||||
$findHostingSubscription->system_password = $phyreServerHostingSubscription['system_password'];
|
||||
|
||||
$findHostingSubscription->domain = $phyreServerHostingSubscription['domain'];
|
||||
$findHostingSubscription->save();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue