| @@ 27-45 (lines=19) @@ | ||
| 24 | return view('workflow.state.create'); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function store(Request $request) |
|
| 28 | { |
|
| 29 | $name = \Transliteration::clean_filename(strtolower($request->label)); |
|
| 30 | $label = $request->label; |
|
| 31 | ||
| 32 | try |
|
| 33 | { |
|
| 34 | WorkflowState::create([ |
|
| 35 | 'name' => $name, |
|
| 36 | 'label' => $label, |
|
| 37 | ]); |
|
| 38 | } |
|
| 39 | catch(\Illuminate\Database\QueryException $e){ |
|
| 40 | // do what you want here with $e->getMessage(); |
|
| 41 | return redirect()->route('state')->with('message', 'Error'); |
|
| 42 | } |
|
| 43 | ||
| 44 | return redirect()->route('state')->with('message', 'Add data success'); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function show($id) |
|
| 48 | { |
|
| @@ 59-74 (lines=16) @@ | ||
| 56 | return view('workflow.state.edit',['state' => $state]); |
|
| 57 | } |
|
| 58 | ||
| 59 | public function update(Request $request, $id) |
|
| 60 | { |
|
| 61 | $name = \Transliteration::clean_filename(strtolower($request->label)); |
|
| 62 | $label = $request->label; |
|
| 63 | ||
| 64 | try |
|
| 65 | { |
|
| 66 | WorkflowState::where('id',$id)->update(['label' => $label, 'name' => $name]); |
|
| 67 | } |
|
| 68 | catch(\Illuminate\Database\QueryException $e){ |
|
| 69 | // do what you want here with $e->getMessage(); |
|
| 70 | return redirect()->route('state')->with('message', 'Error'); |
|
| 71 | } |
|
| 72 | ||
| 73 | return redirect()->route('state')->with('message', 'Update data success'); |
|
| 74 | } |
|
| 75 | ||
| 76 | public function Active($id){ |
|
| 77 | WorkflowState::where('id',$id)->update(['status' => 1]); |
|
| @@ 27-45 (lines=19) @@ | ||
| 24 | return view('workflow::workflow.state.create'); |
|
| 25 | } |
|
| 26 | ||
| 27 | public static function stateStore($request = array()) |
|
| 28 | { |
|
| 29 | $name = \Transliteration::clean_filename(strtolower($request->label)); |
|
| 30 | $label = $request->label; |
|
| 31 | ||
| 32 | try |
|
| 33 | { |
|
| 34 | WorkflowState::create([ |
|
| 35 | 'name' => $name, |
|
| 36 | 'label' => $label, |
|
| 37 | ]); |
|
| 38 | } |
|
| 39 | catch(\Illuminate\Database\QueryException $e){ |
|
| 40 | // do what you want here with $e->getMessage(); |
|
| 41 | return redirect()->route('state')->with('message', 'Error'); |
|
| 42 | } |
|
| 43 | ||
| 44 | return redirect()->route('state')->with('message', 'Add data success'); |
|
| 45 | } |
|
| 46 | ||
| 47 | public static function stateEdit($id) |
|
| 48 | { |
|
| @@ 54-69 (lines=16) @@ | ||
| 51 | return view('workflow::workflow.state.edit',['state' => $state]); |
|
| 52 | } |
|
| 53 | ||
| 54 | public static function stateUpdate($request = array(), $id) |
|
| 55 | { |
|
| 56 | $name = \Transliteration::clean_filename(strtolower($request->label)); |
|
| 57 | $label = $request->label; |
|
| 58 | ||
| 59 | try |
|
| 60 | { |
|
| 61 | WorkflowState::where('id',$id)->update(['label' => $label, 'name' => $name]); |
|
| 62 | } |
|
| 63 | catch(\Illuminate\Database\QueryException $e){ |
|
| 64 | // do what you want here with $e->getMessage(); |
|
| 65 | return redirect()->route('state')->with('message', 'Error'); |
|
| 66 | } |
|
| 67 | ||
| 68 | return redirect()->route('state')->with('message', 'Update data success'); |
|
| 69 | } |
|
| 70 | ||
| 71 | public static function stateActive($id){ |
|
| 72 | WorkflowState::where('id',$id)->update(['status' => 1]); |
|