public function countWorkflowTask() { $user_name = ''; if (auth()->user() != null) { $user_name = auth()->user()->username; } $tmworkflow = collect(TmWorkflow::where(['ISRUN' => 'yes'])->get(['ID']))->toArray(); $tmworkflow = collect(TmWorkflow::where(['ISRUN' => 'yes'])->get(['ID']))->toArray(); $tmworkflowtask = TmWorkflowTask::whereIn('ISRUN', [2, 3])->whereIn('WF_ID', $tmworkflow)->where(function ($q) use($user_name) { $q->where('USER', 'like', '%,' . $user_name . ',%'); $q->orWhere('USER', 'like', $user_name . ',%'); $q->orWhere('USER', 'like', '%,' . $user_name); $q->orWhere('USER', '=', $user_name); })->get(['WF_ID']); return response()->json(count($tmworkflowtask)); }
private function check_prev_finish($prev_id) { $ids = explode(',', $prev_id); if (count($ids) == 1) { return true; } $tmp = TmWorkflowTask::whereIn('ID', $ids)->where('ISRUN', '<>', 1)->where('TASK_CODE', '<>', 'CONDITION_BLOCK')->where('TASK_CODE', '<>', '')->whereNotNull('TASK_CODE')->get(); if (count($tmp) > 0) { return false; } else { return true; } }