updateWorkflow($step);
return response()->json([
'message' => trans('messages.success.changed', ['Module' => trans('v_l_a_n::v_l_a_n_s.name'), 'status' => trans("app.{$step}")]),
'code' => 204,
'redirect' => trans_url('/admin/v_l_a_n_s/v_l_a_n_s/' . $v_l_a_n_s->getRouteKey()),
], 201);
} catch (Exception $e) {
return response()->json([
'message' => $e->getMessage(),
'code' => 400,
'redirect' => trans_url('/admin/v_l_a_n_s/v_l_a_n_s/' . $v_l_a_n_s->getRouteKey()),
], 400);
}
}
/**
* Workflow controller function for v_l_a_n_s.
*
* @param Model $v_l_a_n_s
* @param step next step for the workflow.
* @param user encrypted user id.
*
* @return Response
*/
public function getWorkflow(VLANS $v_l_a_n_s, $step, $user)
{
try {
$user_id = decrypt($user);
Auth::onceUsingId($user_id);
$v_l_a_n_s->updateWorkflow($step);
$data = [
'message' => trans('messages.success.changed', ['Module' => trans('v_l_a_n::v_l_a_n_s.name'), 'status' => trans("app.{$step}")]),
'status' => 'success',
'step' => trans("app.{$step}"),
];
return $this->theme->layout('blank')->of('v_l_a_n::admin.v_l_a_n_s.message', $data)->render();
} catch (ValidationException $e) {
$data = [
'message' => '' . $e->getMessage() . '
' . implode('
', $e->validator->errors()->all()),
'status' => 'error',
'step' => trans("app.{$step}"),
];
return $this->theme->layout('blank')->of('v_l_a_n::admin.v_l_a_n_s.message', $data)->render();
} catch (Exception $e) {
$data = [
'message' => '' . $e->getMessage(). '',
'status' => 'error',
'step' => trans("app.{$step}"),
];
return $this->theme->layout('blank')->of('v_l_a_n::admin.v_l_a_n_s.message', $data)->render();
}
}
}