Skip to content

Commit 4d220e8

Browse files
committed
UP
1 parent 23b0caf commit 4d220e8

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/Filament/Pages/KanbanBoardPage.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Relaticle\Flowforge\Filament\Pages;
44

5-
use App\Models\Task;
65
use Exception;
76
use Filament\Pages\Page;
87
use Relaticle\Flowforge\Contracts\IKanbanAdapter;
@@ -11,6 +10,8 @@ abstract class KanbanBoardPage extends Page
1110
{
1211
protected static string $view = 'flowforge::filament.pages.kanban-board-page';
1312

13+
protected string $model;
14+
1415
/**
1516
* @var string
1617
*/
@@ -76,6 +77,13 @@ public function mount(): void
7677
// This method can be overridden by child classes
7778
}
7879

80+
public function model(string $model): static
81+
{
82+
$this->model = $model;
83+
84+
return $this;
85+
}
86+
7987
/**
8088
* Set the status field for the Kanban board.
8189
*
@@ -225,7 +233,11 @@ public function getAdapter(): IKanbanAdapter
225233
return $this->adapter;
226234
}
227235

228-
$model = $this->getModel();
236+
$model = $this->model;
237+
238+
if(!class_exists($model)) {
239+
throw new Exception("Model class {$model} does not exist.");
240+
}
229241

230242
// Check if the model uses the HasKanbanBoard trait
231243
if (method_exists($model, 'getKanbanAdapter')) {
@@ -278,11 +290,4 @@ public function getAdapter(): IKanbanAdapter
278290

279291
throw new Exception('Model does not use the HasKanbanBoard trait.');
280292
}
281-
282-
/**
283-
* @throws Exception
284-
*/
285-
private function getModel(): string {
286-
throw new Exception('getModel() method not implemented.');
287-
}
288293
}

0 commit comments

Comments
 (0)