NotificationEventTable   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A configure() 0 42 1
1
<?php
2
3
namespace Usamamuneerchaudhary\Notifier\Filament\Resources\NotificationEventResource\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 NotificationEventTable
17
{
18
19
    public static function configure(Table $table): Table
20
    {
21
        return $table
22
            ->columns([
23
                TextColumn::make('group')
24
                    ->searchable()
25
                    ->sortable(),
26
27
                TextColumn::make('name')
28
                    ->searchable()
29
                    ->sortable(),
30
31
                TextColumn::make('key')
32
                    ->searchable()
33
                    ->sortable(),
34
35
                IconColumn::make('is_active')
36
                    ->boolean()
37
                    ->sortable(),
38
39
                TextColumn::make('created_at')
40
                    ->dateTime()
41
                    ->sortable()
42
                    ->toggleable(isToggledHiddenByDefault: true),
43
            ])
44
            ->filters([
45
                SelectFilter::make('group')
46
                    ->options(fn() => NotificationEvent::pluck('group', 'group')->toArray()),
47
48
                TernaryFilter::make('is_active')
49
                    ->label('Active Status'),
50
            ])
51
            ->recordActions([
52
                EditAction::make(),
53
                DeleteAction::make(),
54
            ])
55
            ->toolbarActions([
56
                BulkActionGroup::make([
57
                    DeleteBulkAction::make(),
58
                ]),
59
            ])
60
            ->defaultSort('created_at', 'desc');
61
    }
62
63
}
64