mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 19:04:45 +02:00
71 lines
2.0 KiB
PHP
71 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\WebhookResource\Pages;
|
|
use App\Models\WebhookConfiguration;
|
|
use Filament\Forms\Components\CheckboxList;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class WebhookResource extends Resource
|
|
{
|
|
protected static ?string $model = WebhookConfiguration::class;
|
|
|
|
protected static ?string $navigationIcon = 'tabler-webhook';
|
|
|
|
protected static ?string $navigationGroup = 'Advanced';
|
|
|
|
protected static ?string $label = 'Webhooks';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
TextInput::make('endpoint')->activeUrl()->required(),
|
|
TextInput::make('description')->nullable(),
|
|
CheckboxList::make('events')->lazy()->options(
|
|
fn () => WebhookConfiguration::filamentCheckboxList()
|
|
)
|
|
->searchable()
|
|
->bulkToggleable()
|
|
->columns(3)
|
|
->columnSpanFull()
|
|
->gridDirection('row')
|
|
->required(),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('description'),
|
|
TextColumn::make('endpoint'),
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListWebhookConfigurations::route('/'),
|
|
'create' => Pages\CreateWebhookConfiguration::route('/create'),
|
|
'edit' => Pages\EditWebhookConfiguration::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|