Files

60 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2022-06-27 01:39:01 +08:00
<?php
namespace App\Filament\Resources\System\AgentAllowResource\RelationManagers;
2025-09-21 18:07:38 +08:00
use Filament\Schemas\Schema;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Tables\Columns\TextColumn;
use Filament\Actions\CreateAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
2022-06-27 01:39:01 +08:00
use Filament\Forms;
use Filament\Resources\RelationManagers\RelationManager;
2024-12-25 23:09:07 +08:00
use Filament\Tables\Table;
2022-06-27 01:39:01 +08:00
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class DeniesRelationManager extends RelationManager
{
protected static string $relationship = 'denies';
protected static ?string $recordTitleAttribute = 'name';
2025-09-21 18:07:38 +08:00
public function form(Schema $schema): Schema
2022-06-27 01:39:01 +08:00
{
2025-09-21 18:07:38 +08:00
return $schema
->components([
TextInput::make('name')->required()->maxLength(255)->label(__('label.name')),
TextInput::make('peer_id')->required()->maxLength(255)->label(__('label.agent_deny.peer_id')),
TextInput::make('agent')->required()->maxLength(255)->label(__('label.agent_deny.agent')),
Textarea::make('comment')->label(__('label.comment')),
2022-06-27 01:39:01 +08:00
]);
}
2024-12-25 23:09:07 +08:00
public function table(Table $table): Table
2022-06-27 01:39:01 +08:00
{
return $table
->columns([
2025-09-21 18:07:38 +08:00
TextColumn::make('name')->label(__('label.name')),
TextColumn::make('peer_id')->label(__('label.agent_deny.peer_id')),
TextColumn::make('agent')->label(__('label.agent_deny.agent')),
2022-06-27 01:39:01 +08:00
])
->filters([
//
])
->headerActions([
2025-09-21 18:07:38 +08:00
CreateAction::make(),
2022-06-27 01:39:01 +08:00
])
2025-09-21 18:07:38 +08:00
->recordActions([
EditAction::make(),
DeleteAction::make(),
2022-06-27 01:39:01 +08:00
])
2025-09-21 18:07:38 +08:00
->toolbarActions([
DeleteBulkAction::make(),
2022-06-27 01:39:01 +08:00
]);
}
}