@@ -44,7 +44,8 @@ public static function bootHasWorkflows(): void
4444 return ;
4545 }
4646
47- WorkflowModelStatus::query ()
47+ $ wmsClass = config ('workflow.workflow_model_status_class ' );
48+ $ wmsClass ::query ()
4849 ->withTrashed ()
4950 ->where ('model_type ' , $ model ->getMorphClass ())
5051 ->where ('model_id ' , $ model ->getKey ())
@@ -104,7 +105,7 @@ public function getCurrentWorkflow(): ?Workflow
104105 */
105106 public function modelStatus (): MorphOne
106107 {
107- return $ this ->morphOne (WorkflowModelStatus::class , 'model ' )
108+ return $ this ->morphOne (config ( ' workflow.workflow_model_status_class ' ) , 'model ' )
108109 ->where ('workflow_id ' , $ this ->getCurrentWorkflow ()?->id);
109110 }
110111
@@ -115,15 +116,15 @@ public function modelStatus(): MorphOne
115116 */
116117 public function modelStatuses (): MorphMany
117118 {
118- return $ this ->morphMany (WorkflowModelStatus::class , 'model ' );
119+ return $ this ->morphMany (config ( ' workflow.workflow_model_status_class ' ) , 'model ' );
119120 }
120121
121122 /**
122123 * @throws Throwable
123124 */
124125 public function allModelStatus (): MorphMany
125126 {
126- return $ this ->morphMany (WorkflowModelStatus::class , 'model ' )
127+ return $ this ->morphMany (config ( ' workflow.workflow_model_status_class ' ) , 'model ' )
127128 ->where ('workflow_id ' , $ this ->getCurrentWorkflow ()?->id)
128129 ->withTrashed ();
129130 }
@@ -224,7 +225,8 @@ public function isInFinalStatus(): bool
224225
225226 protected function createModelStatus (Workflow $ workflow , WorkflowStatus $ status ): WorkflowModelStatus
226227 {
227- $ modelStatus = new WorkflowModelStatus ();
228+ $ wmsClass = config ('workflow.workflow_model_status_class ' );
229+ $ modelStatus = new $ wmsClass ();
228230 $ modelStatus ->model ()->associate ($ this );
229231 $ modelStatus ->user ()->associate (Auth::user ());
230232 $ modelStatus ->workflow ()->associate ($ workflow );
0 commit comments