generated from liutk/owl-admin-base
workflow
parent
4ce6d2db9a
commit
82930c1cf5
|
|
@ -39,7 +39,7 @@ class WorkflowController extends Controller
|
|||
|
||||
$query = $model::query()->with($include)
|
||||
// ->whereHas('workflow', fn($q) => $q->where('check_status', CheckStatus::Processing))
|
||||
->whereHas('workflow.logs', fn($q) => $q->own($user))
|
||||
->whereHas('workflow.logs', fn($q) => $q->own($user)->where('check_status', '>', CheckStatus::None->value))
|
||||
->orderBy('created_at', 'desc');
|
||||
|
||||
$list = $query->paginate($request->input('per_page'));
|
||||
|
|
@ -66,8 +66,12 @@ class WorkflowController extends Controller
|
|||
|
||||
$subjectType = $request->input('subject_type');
|
||||
$model = Relation::getMorphedModel($subjectType);
|
||||
|
||||
$resource = $this->mapResource($model);
|
||||
|
||||
// 当前用户是否可以审核
|
||||
$checkable = false;
|
||||
|
||||
$include = ['workflow'];
|
||||
if ($request->input('include')) {
|
||||
$explodes = explode(',', $request->input('include'));
|
||||
|
|
@ -85,14 +89,18 @@ class WorkflowController extends Controller
|
|||
},
|
||||
])->findOrFail($id);
|
||||
$info->taskable->setRelation('task', $info->withoutRelations());
|
||||
$checkable = $info->taskable->workflow->logs()->own($user)->where('check_status', CheckStatus::Processing)->exists();
|
||||
break;
|
||||
|
||||
default:
|
||||
$info = $model::query()->with($include)->findOrFail($id);
|
||||
$checkable = $info->workflow->logs()->own($user)->where('check_status', CheckStatus::Processing)->exists();
|
||||
break;
|
||||
}
|
||||
|
||||
return $resource::make($info);
|
||||
$data = $resource::make($info)->toArray($request);
|
||||
$data['checkable'] = $checkable;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function logs($id, Request $request)
|
||||
|
|
|
|||
Loading…
Reference in New Issue