@@ -10,33 +10,33 @@ class DashboardStatsController extends Controller
1010{
1111 public function index () {
1212
13- $ flowsPastHour = StoredWorkflow::where ('updated_at ' , '>= ' , now ()->subHour ())
13+ $ flowsPastHour = config ( ' workflows.stored_workflow_model ' , StoredWorkflow::class) ::where ('updated_at ' , '>= ' , now ()->subHour ())
1414 ->count ();
1515
16- $ exceptionsPastHour = StoredWorkflowException::where ('created_at ' , '>= ' , now ()->subHour ())
16+ $ exceptionsPastHour = config ( ' workflows.stored_workflow_exception_model ' , StoredWorkflowException::class) ::where ('created_at ' , '>= ' , now ()->subHour ())
1717 ->count ();
1818
19- $ failedFlowsPastWeek = StoredWorkflow::where ('status ' , 'failed ' )
19+ $ failedFlowsPastWeek = config ( ' workflows.stored_workflow_model ' , StoredWorkflow::class) ::where ('status ' , 'failed ' )
2020 ->where ('updated_at ' , '>= ' , now ()->subDays (7 ))
2121 ->count ();
2222
23- $ maxWaitTimeWorkflow = StoredWorkflow::where ('status ' , 'pending ' )
23+ $ maxWaitTimeWorkflow = config ( ' workflows.stored_workflow_model ' , StoredWorkflow::class) ::where ('status ' , 'pending ' )
2424 ->orderBy ('updated_at ' )
2525 ->first ();
2626
27- $ maxDurationWorkflow = StoredWorkflow::select ('* ' )
27+ $ maxDurationWorkflow = config ( ' workflows.stored_workflow_model ' , StoredWorkflow::class) ::select ('* ' )
2828 ->addSelect (DB ::raw ('TIMEDIFF(created_at, updated_at) as duration ' ))
2929 ->where ('status ' , '!= ' , 'pending ' )
3030 ->orderBy ('duration ' )
3131 ->first ();
3232
33- $ maxExceptionsWorkflow = StoredWorkflow::withCount ('exceptions ' )
33+ $ maxExceptionsWorkflow = config ( ' workflows.stored_workflow_model ' , StoredWorkflow::class) ::withCount ('exceptions ' )
3434 ->orderByDesc ('exceptions_count ' )
3535 ->orderByDesc ('updated_at ' )
3636 ->first ();
3737
3838 return response ()->json ([
39- 'flows ' => StoredWorkflow::count (),
39+ 'flows ' => config ( ' workflows.stored_workflow_model ' , StoredWorkflow::class) ::count (),
4040 'flows_per_minute ' => $ flowsPastHour / 60 ,
4141 'flows_past_hour ' => $ flowsPastHour ,
4242 'exceptions_past_hour ' => $ exceptionsPastHour ,
0 commit comments