| @@ 31-55 (lines=25) @@ | ||
| 28 | return view('workflow.transition.create',compact('states')); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function store(Request $request) |
|
| 32 | { |
|
| 33 | $name = str_replace('_','-',\Transliteration::clean_filename(strtolower($request->label))); |
|
| 34 | $label = $request->label; |
|
| 35 | $from = join(',',$request->from); |
|
| 36 | $to = join(',',$request->to); |
|
| 37 | $message = $request->message; |
|
| 38 | ||
| 39 | try |
|
| 40 | { |
|
| 41 | WorkflowTransition::create([ |
|
| 42 | 'name' => $name, |
|
| 43 | 'label' => $label, |
|
| 44 | 'from' => $from, |
|
| 45 | 'to' => $to, |
|
| 46 | 'message' => $message |
|
| 47 | ]); |
|
| 48 | } |
|
| 49 | catch(\Illuminate\Database\QueryException $e){ |
|
| 50 | // do what you want here with $e->getMessage(); |
|
| 51 | return redirect()->route('transition')->with('message', 'Error'); |
|
| 52 | } |
|
| 53 | ||
| 54 | return redirect()->route('transition')->with('message', 'Add data success'); |
|
| 55 | } |
|
| 56 | ||
| 57 | public function show($id) |
|
| 58 | { |
|
| @@ 31-55 (lines=25) @@ | ||
| 28 | return view('workflow::workflow.transition.create',compact('states')); |
|
| 29 | } |
|
| 30 | ||
| 31 | public static function transitionStore($request = array()) |
|
| 32 | { |
|
| 33 | $name = str_replace('_','-',\Transliteration::clean_filename(strtolower($req->label))); |
|
| 34 | $label = $request->label; |
|
| 35 | $from = join(',',$request->from); |
|
| 36 | $to = join(',',$request->to); |
|
| 37 | $message = $request->message; |
|
| 38 | ||
| 39 | try |
|
| 40 | { |
|
| 41 | WorkflowTransition::create([ |
|
| 42 | 'name' => $name, |
|
| 43 | 'label' => $label, |
|
| 44 | 'from' => $from, |
|
| 45 | 'to' => $to, |
|
| 46 | 'message' => $message |
|
| 47 | ]); |
|
| 48 | } |
|
| 49 | catch(\Illuminate\Database\QueryException $e){ |
|
| 50 | // do what you want here with $e->getMessage(); |
|
| 51 | return redirect()->route('transition')->with('message', 'Error'); |
|
| 52 | } |
|
| 53 | ||
| 54 | return redirect()->route('transition')->with('message', 'Add data success'); |
|
| 55 | } |
|
| 56 | ||
| 57 | public static function transitionEdit($id) |
|
| 58 | { |
|