Skip to content

Commit

Permalink
Merge pull request #2 from a21ns1g4ts/patch-1
Browse files Browse the repository at this point in the history
Fix soft delete scope in FirewallIpResource.php
  • Loading branch information
cklei-carly authored Jun 21, 2023
2 parents 9b1188f + 0fb8396 commit 71a96bd
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Filament/Resources/FirewallIpResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Str;
use SolutionForest\FilamentFirewall\Filament\Resources\FirewallIpResource\Pages;
Expand All @@ -22,14 +24,13 @@ public static function form(Form $form): Form
->default(fn () => Request::getClientIp())
->regex('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/')
->validationAttribute(Str::upper(__('filament-firewall::filament-firewall.form.field.ip')))
->suffixAction(fn (callable $set) =>
Forms\Components\Actions\Action::make('fillMyIp')
->label(__('filament-firewall::filament-firewall.action.fillMyIp'))
->icon('heroicon-o-pencil-alt')
->action(fn () => $set('ip', Request::getClientIp()))
->suffixAction(fn (callable $set) => Forms\Components\Actions\Action::make('fillMyIp')
->label(__('filament-firewall::filament-firewall.action.fillMyIp'))
->icon('heroicon-o-pencil-alt')
->action(fn () => $set('ip', Request::getClientIp()))
)
->required(),

Forms\Components\TextInput::make('prefix_size')
->label(__('filament-firewall::filament-firewall.form.field.prefix_size'))
->numeric()
Expand Down Expand Up @@ -133,4 +134,12 @@ protected static function getNavigationGroup(): ?string
{
return __('filament-firewall::filament-firewall.filament.resource.ip.getNavigationGroup');
}

public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

0 comments on commit 71a96bd

Please sign in to comment.