File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 22
33namespace Relaticle \Flowforge \Filament \Pages ;
44
5- use App \Models \Task ;
65use Exception ;
76use Filament \Pages \Page ;
87use 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}
You can’t perform that action at this time.
0 commit comments