Skip to content

Commit 8d05fe4

Browse files
committed
Update the Filament version to 4
1 parent 140b262 commit 8d05fe4

File tree

6 files changed

+42
-30
lines changed

6 files changed

+42
-30
lines changed

composer.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,23 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^8.2",
24-
"filament/filament": "^3.0",
23+
"php": "^8.3",
24+
"filament/filament": "^4.0",
2525
"spatie/laravel-package-tools": "^1.15.0"
2626
},
2727
"require-dev": {
28+
"filament/upgrade": "^4.0",
29+
"larastan/larastan": "^3.0",
2830
"laravel/pint": "^1.0",
29-
"nunomaduro/collision": "^7.9",
30-
"nunomaduro/larastan": "^2.0.1",
31-
"orchestra/testbench": "^8.0",
32-
"pestphp/pest": "^2.1",
33-
"pestphp/pest-plugin-arch": "^2.0",
34-
"pestphp/pest-plugin-laravel": "^2.0",
35-
"phpstan/extension-installer": "^1.1",
36-
"phpstan/phpstan-deprecation-rules": "^1.0",
37-
"phpstan/phpstan-phpunit": "^1.0",
31+
"nunomaduro/collision": "^8.0",
32+
"orchestra/testbench": "^9.0",
33+
"pestphp/pest": "^3.0",
34+
"pestphp/pest-plugin-arch": "^3.0",
35+
"pestphp/pest-plugin-laravel": "^3.0",
36+
"pestphp/pest-plugin-livewire": "^3.0",
37+
"phpstan/extension-installer": "^1.4",
38+
"phpstan/phpstan-deprecation-rules": "^2.0",
39+
"phpstan/phpstan-phpunit": "^2.0",
3840
"spatie/laravel-ray": "^1.26"
3941
},
4042
"autoload": {
@@ -72,6 +74,6 @@
7274
}
7375
}
7476
},
75-
"minimum-stability": "dev",
77+
"minimum-stability": "beta",
7678
"prefer-stable": true
7779
}

src/Adapters/DefaultKanbanAdapter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Relaticle\Flowforge\Adapters;
66

7+
use EloquentSerialize;
78
use Illuminate\Database\Eloquent\Builder;
89
use Livewire\Wireable;
910
use Relaticle\Flowforge\Concerns\CardFormattingTrait;
@@ -44,14 +45,14 @@ public function getConfig(): KanbanConfig
4445
public function toLivewire(): array
4546
{
4647
return [
47-
'query' => \EloquentSerialize::serialize($this->baseQuery),
48+
'query' => EloquentSerialize::serialize($this->baseQuery),
4849
'config' => $this->config,
4950
];
5051
}
5152

5253
public static function fromLivewire($value): static
5354
{
54-
$query = \EloquentSerialize::unserialize($value['query']);
55+
$query = EloquentSerialize::unserialize($value['query']);
5556

5657
return new static($query, $value['config']);
5758
}

src/Commands/MakeKanbanBoardCommand.php

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

33
namespace Relaticle\Flowforge\Commands;
44

5+
use RuntimeException;
56
use Illuminate\Console\Command;
67
use Illuminate\Filesystem\Filesystem;
78
use Illuminate\Support\Str;
@@ -120,7 +121,7 @@ protected function getStub(string $name): string
120121
$stubPath = __DIR__ . '/../../stubs/' . $name;
121122

122123
if (! $this->files->exists($stubPath)) {
123-
throw new \RuntimeException("Stub file not found: {$stubPath}");
124+
throw new RuntimeException("Stub file not found: {$stubPath}");
124125
}
125126

126127
return $this->files->get($stubPath);

src/Concerns/CrudOperationsTrait.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Relaticle\Flowforge\Concerns;
66

7-
use Filament\Forms\Form;
7+
use Filament\Schemas\Schema;
88
use Illuminate\Database\Eloquent\Model;
99
use Illuminate\Database\Eloquent\SoftDeletingScope;
1010

@@ -16,17 +16,17 @@ trait CrudOperationsTrait
1616
/**
1717
* Create a new record with the given attributes.
1818
*/
19-
public function createRecord(Form $form, mixed $currentColumn): ?Model
19+
public function createRecord(Schema $schema, mixed $currentColumn): ?Model
2020
{
2121
$model = $this->baseQuery->getModel()->newInstance();
2222

2323
$model->fill([
24-
...$form->getState(),
24+
...$schema->getState(),
2525
$this->config->getColumnField() => $currentColumn,
2626
]);
2727

2828
if ($model->save()) {
29-
$form->model($model)->saveRelationships();
29+
$schema->model($model)->saveRelationships();
3030

3131
return $model;
3232
}
@@ -39,11 +39,11 @@ public function createRecord(Form $form, mixed $currentColumn): ?Model
3939
*
4040
* @param Model $record The record to update
4141
*/
42-
public function updateRecord(Model $record, Form $form): bool
42+
public function updateRecord(Model $record, Schema $schema): bool
4343
{
44-
$record->fill($form->getState());
44+
$record->fill($schema->getState());
4545

46-
$form->model($record)->saveRelationships();
46+
$schema->model($record)->saveRelationships();
4747

4848
return $record->save();
4949
}

src/Config/KanbanConfig.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Relaticle\Flowforge\Config;
66

7-
use Filament\Forms\Components\Component;
7+
use BadMethodCallException;
88
use Filament\Forms\Components\Select;
99
use Filament\Forms\Components\Textarea;
1010
use Filament\Forms\Components\TextInput;
@@ -166,7 +166,7 @@ public function getPluralCardLabel(): string
166166
*
167167
* @param string $titleField The field name used for card titles
168168
* @param string|null $descriptionField Optional field name for card descriptions
169-
* @return array<Component> The default form schema
169+
* @return array<\Filament\Schemas\Components\Component> The default form schema
170170
*/
171171
public static function getDefaultCreateFormSchema(string $titleField, ?string $descriptionField): array
172172
{
@@ -192,7 +192,7 @@ public static function getDefaultCreateFormSchema(string $titleField, ?string $d
192192
* @param string|null $descriptionField Optional field name for card descriptions
193193
* @param string $columnField The field name that determines which column a card belongs to
194194
* @param array<string, string> $columnValues Available column values with their labels
195-
* @return array<Component> The default form schema
195+
* @return array<\Filament\Schemas\Components\Component> The default form schema
196196
*/
197197
public static function getDefaultEditFormSchema(
198198
string $titleField,
@@ -230,18 +230,18 @@ public static function getDefaultEditFormSchema(
230230
* @param array $arguments The method arguments
231231
* @return self A new instance with the updated property
232232
*
233-
* @throws \BadMethodCallException If the method is not a valid with* method or targets a non-existent property
233+
* @throws BadMethodCallException If the method is not a valid with* method or targets a non-existent property
234234
*/
235235
public function __call(string $method, array $arguments): self
236236
{
237237
if (! Str::startsWith($method, 'with')) {
238-
throw new \BadMethodCallException("Method {$method} not found");
238+
throw new BadMethodCallException("Method {$method} not found");
239239
}
240240

241241
$property = lcfirst(Str::after($method, 'with'));
242242

243243
if (! property_exists($this, $property)) {
244-
throw new \BadMethodCallException("Property {$property} not found");
244+
throw new BadMethodCallException("Property {$property} not found");
245245
}
246246

247247
return $this->with([$property => $arguments[0]]);

src/Filament/Pages/KanbanBoardPage.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Relaticle\Flowforge\Filament\Pages;
66

7+
use InvalidArgumentException;
78
use Filament\Pages\Page;
89
use Illuminate\Support\Str;
910
use Relaticle\Flowforge\Adapters\DefaultKanbanAdapter;
@@ -13,7 +14,7 @@
1314

1415
abstract class KanbanBoardPage extends Page implements KanbanBoardPageInterface
1516
{
16-
protected static string $view = 'flowforge::filament.pages.kanban-board-page';
17+
protected string $view = 'flowforge::filament.pages.kanban-board-page';
1718

1819
/**
1920
* The Kanban configuration object.
@@ -31,6 +32,7 @@ public function __construct()
3132
/**
3233
* Set the field that stores the column value.
3334
*
35+
* @param string $field
3436
* @return KanbanBoardPage
3537
*/
3638
public function columnField(string $field): static
@@ -43,6 +45,7 @@ public function columnField(string $field): static
4345
/**
4446
* Set the field that stores the column value.
4547
*
48+
* @param string $field
4649
* @return KanbanBoardPage
4750
*/
4851
public function priorityField(string $field): static
@@ -67,6 +70,7 @@ public function columns(array $columns): static
6770
/**
6871
* Set the title field for the Kanban cards.
6972
*
73+
* @param string $field
7074
* @return KanbanBoardPage
7175
*/
7276
public function titleField(string $field): static
@@ -79,6 +83,7 @@ public function titleField(string $field): static
7983
/**
8084
* Set the description field for the Kanban cards.
8185
*
86+
* @param string $field
8287
* @return KanbanBoardPage
8388
*/
8489
public function descriptionField(string $field): static
@@ -139,6 +144,7 @@ public function columnColors(?array $colors = null): static
139144
/**
140145
* Set the order field for the Kanban board.
141146
*
147+
* @param string $field
142148
* @return KanbanBoardPage
143149
*/
144150
public function orderField(string $field): static
@@ -151,6 +157,7 @@ public function orderField(string $field): static
151157
/**
152158
* Set the label for individual cards.
153159
*
160+
* @param string $label
154161
* @return KanbanBoardPage
155162
*/
156163
public function cardLabel(string $label): static
@@ -170,6 +177,7 @@ public function cardLabel(string $label): static
170177
/**
171178
* Set the plural label for multiple cards.
172179
*
180+
* @param string $label
173181
* @return KanbanBoardPage
174182
*/
175183
public function pluralCardLabel(string $label): static
@@ -182,7 +190,7 @@ public function pluralCardLabel(string $label): static
182190
/**
183191
* Get the Kanban adapter.
184192
*
185-
* @throws \InvalidArgumentException If the subject is not set
193+
* @throws InvalidArgumentException If the subject is not set
186194
*/
187195
public function getAdapter(): KanbanAdapterInterface
188196
{

0 commit comments

Comments
 (0)