| @@ 41-59 (lines=19) @@ | ||
| 38 | * |
|
| 39 | * @return Response |
|
| 40 | */ |
|
| 41 | public function store(Request $request) |
|
| 42 | { |
|
| 43 | $name = \Transliteration::clean_filename(strtolower($request->label)); |
|
| 44 | $label = $request->label; |
|
| 45 | ||
| 46 | try |
|
| 47 | { |
|
| 48 | WorkflowState::create([ |
|
| 49 | 'name' => $name, |
|
| 50 | 'label' => $label, |
|
| 51 | ]); |
|
| 52 | } |
|
| 53 | catch(\Illuminate\Database\QueryException $e){ |
|
| 54 | // do what you want here with $e->getMessage(); |
|
| 55 | return redirect()->route('state')->with('message', 'Error'); |
|
| 56 | } |
|
| 57 | ||
| 58 | return redirect()->route('state')->with('message', 'Add data success'); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Display the specified resource. |
|
| @@ 91-106 (lines=16) @@ | ||
| 88 | * @param int $id |
|
| 89 | * @return Response |
|
| 90 | */ |
|
| 91 | public function update(Request $request, $id) |
|
| 92 | { |
|
| 93 | $name = \Transliteration::clean_filename(strtolower($request->label)); |
|
| 94 | $label = $request->label; |
|
| 95 | ||
| 96 | try |
|
| 97 | { |
|
| 98 | WorkflowState::where('id',$id)->update(['label' => $label, 'name' => $name]); |
|
| 99 | } |
|
| 100 | catch(\Illuminate\Database\QueryException $e){ |
|
| 101 | // do what you want here with $e->getMessage(); |
|
| 102 | return redirect()->route('state')->with('message', 'Error'); |
|
| 103 | } |
|
| 104 | ||
| 105 | return redirect()->route('state')->with('message', 'Update data success'); |
|
| 106 | } |
|
| 107 | /** |
|
| 108 | * Activete the specified resource from storage. |
|
| 109 | * |
|
| @@ 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]); |
|