mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
migration script
# Conflicts: # app/Filament/Resources/Torrent/AnnounceLogResource.php
This commit is contained in:
@@ -2,11 +2,21 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\AgentDenyResource\Pages\ListAgentDenies;
|
||||
use App\Filament\Resources\System\AgentDenyResource\Pages\CreateAgentDeny;
|
||||
use App\Filament\Resources\System\AgentDenyResource\Pages\EditAgentDeny;
|
||||
use App\Filament\Resources\System\AgentDenyResource\Pages;
|
||||
use App\Filament\Resources\System\AgentDenyResource\RelationManagers;
|
||||
use App\Models\AgentDeny;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -17,9 +27,9 @@ class AgentDenyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = AgentDeny::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-no-symbol';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-no-symbol';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
@@ -33,16 +43,16 @@ class AgentDenyResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('family_id')->label('Allow family')
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('family_id')->label('Allow family')
|
||||
->relationship('family', 'family')->required()->label(__('label.agent_allow.family')),
|
||||
Forms\Components\TextInput::make('name')->required()->label(__('label.name')),
|
||||
Forms\Components\TextInput::make('peer_id')->required()->label(__('label.agent_deny.peer_id')),
|
||||
Forms\Components\TextInput::make('agent')->required()->label(__('label.agent_deny.agent')),
|
||||
Forms\Components\Textarea::make('comment')->label(__('label.comment')),
|
||||
TextInput::make('name')->required()->label(__('label.name')),
|
||||
TextInput::make('peer_id')->required()->label(__('label.agent_deny.peer_id')),
|
||||
TextInput::make('agent')->required()->label(__('label.agent_deny.agent')),
|
||||
Textarea::make('comment')->label(__('label.comment')),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -50,26 +60,26 @@ class AgentDenyResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('family.family')->label(__('label.agent_allow.family')),
|
||||
Tables\Columns\TextColumn::make('name')->searchable()->label(__('label.name')),
|
||||
Tables\Columns\TextColumn::make('peer_id')->searchable()->label(__('label.agent_deny.peer_id')),
|
||||
Tables\Columns\TextColumn::make('agent')->searchable()->label(__('label.agent_deny.agent')),
|
||||
TextColumn::make('id')->sortable(),
|
||||
TextColumn::make('family.family')->label(__('label.agent_allow.family')),
|
||||
TextColumn::make('name')->searchable()->label(__('label.name')),
|
||||
TextColumn::make('peer_id')->searchable()->label(__('label.agent_deny.peer_id')),
|
||||
TextColumn::make('agent')->searchable()->label(__('label.agent_deny.agent')),
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make()->using(function ($record) {
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()->using(function ($record) {
|
||||
$record->delete();
|
||||
clear_agent_allow_deny_cache();
|
||||
return redirect(self::getUrl());
|
||||
})
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -83,9 +93,9 @@ class AgentDenyResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAgentDenies::route('/'),
|
||||
'create' => Pages\CreateAgentDeny::route('/create'),
|
||||
'edit' => Pages\EditAgentDeny::route('/{record}/edit'),
|
||||
'index' => ListAgentDenies::route('/'),
|
||||
'create' => CreateAgentDeny::route('/create'),
|
||||
'edit' => EditAgentDeny::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user