Skip to content

Commit 6e2750f

Browse files
committed
Upgrade to Filament 4
1 parent e8882d8 commit 6e2750f

File tree

6 files changed

+64
-50
lines changed

6 files changed

+64
-50
lines changed

.github/workflows/run-tests.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ jobs:
1818
matrix:
1919
os: [ubuntu-latest]
2020
php: [8.3, 8.2]
21-
laravel: [10.*]
21+
laravel: [12.*]
2222
stability: [prefer-lowest, prefer-stable]
2323
include:
24-
- laravel: 10.*
25-
testbench: 8.*
26-
carbon: ^2.63
24+
- laravel: 12.*
25+
testbench: ^10.0
2726

2827
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2928

@@ -45,7 +44,7 @@ jobs:
4544
4645
- name: Install dependencies
4746
run: |
48-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
47+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
4948
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
5049
5150
- name: List Installed Dependencies

composer.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,21 @@
2525
"require": {
2626
"php": "^8.2",
2727
"spatie/laravel-package-tools": "^1.16",
28-
"filament/filament": "^3.0-stable",
28+
"filament/filament": "^4.0",
2929
"illuminate/contracts": "^10.0||^11.0||^12.0",
3030
"spatie/laravel-webhook-client": "^3.4"
3131
},
3232
"require-dev": {
3333
"laravel/pint": "^1.14",
3434
"nunomaduro/collision": "^8.1.1||^7.10.0",
35-
"larastan/larastan": "^2.9",
36-
"orchestra/testbench": "^9.0.0||^8.22.0",
37-
"pestphp/pest": "^2.34",
38-
"pestphp/pest-plugin-arch": "^2.7",
39-
"pestphp/pest-plugin-laravel": "^2.3",
35+
"larastan/larastan": "^3.0||^2.9",
36+
"orchestra/testbench": "^10.0.0||^9.0.0||^8.22.0",
37+
"pestphp/pest": "^3.0||^2.34",
38+
"pestphp/pest-plugin-arch": "^3.0||^2.7",
39+
"pestphp/pest-plugin-laravel": "^3.0||^2.3",
4040
"phpstan/extension-installer": "^1.3",
41-
"phpstan/phpstan-deprecation-rules": "^1.1",
42-
"phpstan/phpstan-phpunit": "^1.3",
43-
"spatie/laravel-ray": "^1.35"
41+
"phpstan/phpstan-deprecation-rules": "^2.0||^1.1",
42+
"phpstan/phpstan-phpunit": "^2.0||^1.3"
4443
},
4544
"autoload": {
4645
"psr-4": {

config/filament-webhook-client.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<?php
22

3+
use Tapp\FilamentWebhookClient\Resources\WebhookCallResource;
4+
use Spatie\WebhookClient\Models\WebhookCall;
5+
use Tapp\FilamentWebhookClient\Policies\WebhookCallPolicy;
6+
37
return [
48

59
'resources' => [
6-
'WebhookCallResource' => \Tapp\FilamentWebhookClient\Resources\WebhookCallResource::class,
10+
'WebhookCallResource' => WebhookCallResource::class,
711
],
812

913
'models' => [
10-
'webhook-call' => \Spatie\WebhookClient\Models\WebhookCall::class,
14+
'webhook-call' => WebhookCall::class,
1115
],
1216

1317
'policies' => [
14-
'webhook-call' => \Tapp\FilamentWebhookClient\Policies\WebhookCallPolicy::class,
18+
'webhook-call' => WebhookCallPolicy::class,
1519
],
1620

1721
'navigation' => [

src/Resources/WebhookCallResource.php

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22

33
namespace Tapp\FilamentWebhookClient\Resources;
44

5+
use Filament\Schemas\Schema;
6+
use Filament\Infolists\Components\TextEntry;
7+
use Filament\Infolists\Components\ViewEntry;
8+
use Filament\Forms\Components\TextInput;
9+
use Filament\Forms\Components\Textarea;
10+
use Filament\Tables\Columns\TextColumn;
11+
use Filament\Actions\ViewAction;
12+
use Filament\Actions\BulkActionGroup;
13+
use Filament\Actions\DeleteBulkAction;
14+
use Tapp\FilamentWebhookClient\Resources\WebhookCallResource\Pages\ListWebhookCalls;
15+
use Tapp\FilamentWebhookClient\Resources\WebhookCallResource\Pages\CreateWebhookCall;
16+
use Tapp\FilamentWebhookClient\Resources\WebhookCallResource\Pages\EditWebhookCall;
517
use Filament\Forms;
6-
use Filament\Forms\Form;
718
use Filament\Infolists;
8-
use Filament\Infolists\Infolist;
919
use Filament\Resources\Resource;
1020
use Filament\Tables;
1121
use Filament\Tables\Table;
@@ -41,41 +51,41 @@ public static function getPluralLabel(): string
4151
return __('filament-webhook-client::filament-webhook-client.navigation.plural-label');
4252
}
4353

44-
public static function infolist(Infolist $infolist): Infolist
54+
public static function infolist(Schema $schema): Schema
4555
{
46-
return $infolist
47-
->schema([
48-
Infolists\Components\TextEntry::make('id')
56+
return $schema
57+
->components([
58+
TextEntry::make('id')
4959
->label('ID'),
50-
Infolists\Components\TextEntry::make('name'),
51-
Infolists\Components\TextEntry::make('url'),
52-
Infolists\Components\ViewEntry::make('headers')
60+
TextEntry::make('name'),
61+
TextEntry::make('url'),
62+
ViewEntry::make('headers')
5363
->view('filament-webhook-client::infolists.entries.formatted-json')
5464
->columnSpanFull(),
55-
Infolists\Components\ViewEntry::make('payload')
65+
ViewEntry::make('payload')
5666
->view('filament-webhook-client::infolists.entries.formatted-json')
5767
->columnSpanFull(),
58-
Infolists\Components\ViewEntry::make('exception')
68+
ViewEntry::make('exception')
5969
->view('filament-webhook-client::infolists.entries.formatted-json')
6070
->columnSpanFull(),
6171
]);
6272
}
6373

64-
public static function form(Form $form): Form
74+
public static function form(Schema $schema): Schema
6575
{
66-
return $form
67-
->schema([
68-
Forms\Components\TextInput::make('name')
76+
return $schema
77+
->components([
78+
TextInput::make('name')
6979
->required()
7080
->maxLength(255),
71-
Forms\Components\TextInput::make('url')
81+
TextInput::make('url')
7282
->required()
7383
->maxLength(255),
74-
Forms\Components\TextInput::make('headers')
84+
TextInput::make('headers')
7585
->columnSpanFull(),
76-
Forms\Components\Textarea::make('payload')
86+
Textarea::make('payload')
7787
->columnSpanFull(),
78-
Forms\Components\Textarea::make('exception')
88+
Textarea::make('exception')
7989
->columnSpanFull(),
8090
]);
8191
}
@@ -84,32 +94,32 @@ public static function table(Table $table): Table
8494
{
8595
return $table
8696
->columns([
87-
Tables\Columns\TextColumn::make('name')
97+
TextColumn::make('name')
8898
->sortable()
8999
->searchable(),
90-
Tables\Columns\TextColumn::make('url')
100+
TextColumn::make('url')
91101
->sortable()
92102
->searchable(),
93-
Tables\Columns\TextColumn::make('created_at')
103+
TextColumn::make('created_at')
94104
->dateTime()
95105
->sortable()
96106
->toggleable(isToggledHiddenByDefault: true),
97-
Tables\Columns\TextColumn::make('updated_at')
107+
TextColumn::make('updated_at')
98108
->dateTime()
99109
->sortable()
100110
->toggleable(isToggledHiddenByDefault: true),
101111
])
102112
->filters([
103113
//
104114
])
105-
->actions([
106-
Tables\Actions\ViewAction::make()
115+
->recordActions([
116+
ViewAction::make()
107117
->stickyModalFooter()
108118
->stickyModalHeader(),
109119
])
110-
->bulkActions([
111-
Tables\Actions\BulkActionGroup::make([
112-
Tables\Actions\DeleteBulkAction::make(),
120+
->toolbarActions([
121+
BulkActionGroup::make([
122+
DeleteBulkAction::make(),
113123
]),
114124
]);
115125
}
@@ -124,9 +134,9 @@ public static function getRelations(): array
124134
public static function getPages(): array
125135
{
126136
return [
127-
'index' => Pages\ListWebhookCalls::route('/'),
128-
'create' => Pages\CreateWebhookCall::route('/create'),
129-
'edit' => Pages\EditWebhookCall::route('/{record}/edit'),
137+
'index' => ListWebhookCalls::route('/'),
138+
'create' => CreateWebhookCall::route('/create'),
139+
'edit' => EditWebhookCall::route('/{record}/edit'),
130140
];
131141
}
132142
}

src/Resources/WebhookCallResource/Pages/EditWebhookCall.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Tapp\FilamentWebhookClient\Resources\WebhookCallResource\Pages;
44

5+
use Filament\Actions\DeleteAction;
56
use Filament\Actions;
67
use Filament\Resources\Pages\EditRecord;
78
use Tapp\FilamentWebhookClient\Resources\WebhookCallResource;
@@ -13,7 +14,7 @@ class EditWebhookCall extends EditRecord
1314
protected function getHeaderActions(): array
1415
{
1516
return [
16-
Actions\DeleteAction::make(),
17+
DeleteAction::make(),
1718
];
1819
}
1920
}

src/Resources/WebhookCallResource/Pages/ListWebhookCalls.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Tapp\FilamentWebhookClient\Resources\WebhookCallResource\Pages;
44

5+
use Filament\Actions\CreateAction;
56
use Filament\Actions;
67
use Filament\Resources\Pages\ListRecords;
78
use Tapp\FilamentWebhookClient\Resources\WebhookCallResource;
@@ -13,7 +14,7 @@ class ListWebhookCalls extends ListRecords
1314
protected function getHeaderActions(): array
1415
{
1516
return [
16-
Actions\CreateAction::make(),
17+
CreateAction::make(),
1718
];
1819
}
1920
}

0 commit comments

Comments
 (0)