NotificationTemplateTable   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 27
c 1
b 0
f 1
dl 0
loc 34
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A configure() 0 31 1
1
<?php
2
3
namespace Usamamuneerchaudhary\Notifier\Filament\Resources\NotificationTemplateResource\Tables;
4
5
use Filament\Actions\BulkActionGroup;
6
use Filament\Actions\DeleteAction;
7
use Filament\Actions\DeleteBulkAction;
8
use Filament\Actions\EditAction;
0 ignored issues
show
Bug introduced by
The type Filament\Actions\EditAction was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Filament\Tables\Columns\IconColumn;
10
use Filament\Tables\Columns\TextColumn;
11
use Filament\Tables\Filters\SelectFilter;
12
use Filament\Tables\Filters\TernaryFilter;
13
use Filament\Tables\Table;
14
use Usamamuneerchaudhary\Notifier\Models\NotificationEvent;
15
16
class NotificationTemplateTable
17
{
18
19
    public static function configure(Table $table): Table
20
    {
21
        return $table
22
            ->columns([
23
                TextColumn::make('name')
24
                    ->label('Template Name')
25
                    ->searchable()
26
                    ->sortable(),
27
                TextColumn::make('event.name')
28
                    ->label('Event')
29
                    ->searchable()
30
                    ->sortable(),
31
                IconColumn::make('is_active')
32
                    ->boolean(),
33
                TextColumn::make('created_at')
34
                    ->dateTime()
35
                    ->sortable(),
36
            ])
37
            ->filters([
38
                SelectFilter::make('event_key')
39
                    ->label('Event')
40
                    ->options(fn() => NotificationEvent::pluck('name', 'key')->toArray()),
41
                TernaryFilter::make('is_active'),
42
            ])
43
            ->recordActions([
44
                EditAction::make(),
45
                DeleteAction::make(),
46
            ])
47
            ->toolbarActions([
48
                BulkActionGroup::make([
49
                    DeleteBulkAction::make(),
50
                ]),
51
            ]);
52
    }
53
54
}
55