Skip to content

Commit 0ae21b6

Browse files
committed
Add BoardResourcePage and enhance InteractsWithKanbanQuery for improved query handling
1 parent f77ea69 commit 0ae21b6

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

src/BoardResourcePage.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Relaticle\Flowforge;
6+
7+
use Filament\Actions\Concerns\InteractsWithActions;
8+
use Filament\Actions\Contracts\HasActions;
9+
use Filament\Forms\Concerns\InteractsWithForms;
10+
use Filament\Forms\Contracts\HasForms;
11+
use Filament\Resources\Pages\Page;
12+
use Relaticle\Flowforge\Concerns\InteractsWithBoard;
13+
use Relaticle\Flowforge\Contracts\HasBoard;
14+
15+
/**
16+
* Simplified BoardPage - just like Filament's pages.
17+
* No adapters, no complex caching - just clean delegation.
18+
*/
19+
abstract class BoardResourcePage extends Page implements HasActions, HasBoard, HasForms
20+
{
21+
use InteractsWithActions;
22+
use InteractsWithBoard {
23+
InteractsWithBoard::getDefaultActionRecord insteadof InteractsWithActions;
24+
}
25+
use InteractsWithForms;
26+
27+
protected string $view = 'flowforge::filament.pages.board-page';
28+
29+
/**
30+
* Configure the board - implement in subclasses.
31+
*/
32+
abstract public function board(Board $board): Board;
33+
}

src/Concerns/InteractsWithKanbanQuery.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66

77
use Closure;
88
use Illuminate\Database\Eloquent\Builder;
9+
use Illuminate\Database\Eloquent\Relations\Relation;
910

1011
trait InteractsWithKanbanQuery
1112
{
12-
protected Builder | Closure | null $query = null;
13+
protected Builder | Relation | Closure | null $query = null;
1314

1415
protected string | Closure | null $columnIdentifierAttribute = null;
1516

1617
protected array | Closure | null $reorderBy = null;
1718

18-
public function query(Builder | Closure $query): static
19+
public function query(Builder | Relation | Closure $query): static
1920
{
2021
$this->query = $query;
2122

@@ -39,7 +40,7 @@ public function reorderBy(string $column, string $direction = 'asc'): static
3940
return $this;
4041
}
4142

42-
public function getQuery(): ?Builder
43+
public function getQuery(): Builder|Relation|null
4344
{
4445
return $this->evaluate($this->query);
4546
}

0 commit comments

Comments
 (0)