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