Update HostingSubscriptionResource.php

This commit is contained in:
Bozhidar Slaveykov 2024-04-04 17:04:50 +03:00
parent 13d51734b9
commit 4b4eb4b8dc

View file

@ -6,12 +6,14 @@ use App\Filament\Resources\HostingSubscriptionResource\Pages;
use App\Filament\Resources\HostingSubscriptionResource\RelationManagers;
use App\Models\HostingSubscription;
use Filament\Forms;
use Filament\Forms\Components\Field;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\HtmlString;
class HostingSubscriptionResource extends Resource
{
@ -30,6 +32,12 @@ class HostingSubscriptionResource extends Resource
return $form
->schema([
Forms\Components\Placeholder::make('Website Link')
->content(fn ($record) => new HtmlString('
<a href="http://' . $record->domain . '" target="_blank" class="text-sm font-medium text-primary-600 dark:text-primary-400">
http://' . $record->domain . '
</a>')),
Forms\Components\TextInput::make('domain')
->required()
->disabled(function ($record) {
@ -63,8 +71,12 @@ class HostingSubscriptionResource extends Resource
)
->required()->columnSpanFull(),
Forms\Components\TextInput::make('username')
Forms\Components\Checkbox::make('advanced')
->live()
->columnSpanFull(),
Forms\Components\TextInput::make('username')
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
->disabled(function ($record) {
if (isset($record->exists)) {
return $record->exists;
@ -75,6 +87,7 @@ class HostingSubscriptionResource extends Resource
->suffixIcon('heroicon-m-user'),
Forms\Components\TextInput::make('password')
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
->disabled(function ($record) {
if (isset($record->exists)) {
return $record->exists;
@ -85,6 +98,7 @@ class HostingSubscriptionResource extends Resource
->suffixIcon('heroicon-m-lock-closed'),
Forms\Components\Textarea::make('description')
->hidden(fn (Forms\Get $get): bool => ! $get('advanced'))
->columnSpanFull(),
]);