From 1f38de989b54ed67ca878a22052c7698331b1185 Mon Sep 17 00:00:00 2001 From: KodeStar Date: Sun, 18 Feb 2018 22:36:32 +0000 Subject: [PATCH] fix routes --- app/Http/Controllers/ItemController.php | 28 +++++++++++++-------- app/Http/Controllers/SettingsController.php | 16 +++++++++--- app/Http/Controllers/TagController.php | 12 ++++++--- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 6efbd31e9..f087c26e0 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -49,7 +49,8 @@ public function pin($id) $item = Item::findOrFail($id); $item->pinned = true; $item->save(); - return redirect()->route('dash', [], false); + $route = route('dash', [], false); + return redirect($route); } /** @@ -62,7 +63,8 @@ public function unpin($id) $item = Item::findOrFail($id); $item->pinned = false; $item->save(); - return redirect()->route('dash', [], false); + $route = route('dash', [], false); + return redirect($route); } /** @@ -81,8 +83,9 @@ public function pinToggle($id, $ajax=false) $data['ajax'] = true; return view('sortable', $data); } else { - return redirect()->route('dash', [], false); - } + $route = route('dash', [], false); + return redirect($route); + } } @@ -151,7 +154,8 @@ public function store(Request $request) $item->parents()->sync($request->tags); - return redirect()->route('dash', [], false) + $route = route('dash', [], false); + return redirect($route) ->with('success', __('app.alert.success.item_created')); } @@ -214,7 +218,8 @@ public function update(Request $request, $id) $item->parents()->sync($request->tags); - return redirect()->route('dash', [], false) + $route = route('dash', [], false); + return redirect($route) ->with('success',__('app.alert.success.item_updated')); } @@ -235,8 +240,9 @@ public function destroy(Request $request, $id) } else { Item::find($id)->delete(); } - - return redirect()->route('items.index', [], false) + + $route = route('items.index', [], false); + return redirect($route) ->with('success',__('app.alert.success.item_deleted')); } @@ -251,8 +257,10 @@ public function restore($id) // Item::withTrashed() ->where('id', $id) - ->restore(); - return redirect()->route('items.index', [], false) + ->restore(); + + $route = route('items.inded', [], false); + return redirect($route) ->with('success',__('app.alert.success.item_restored')); } diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index c37e24838..843e2de0d 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -39,7 +39,9 @@ public function edit($id) 'setting' => $setting, ]); } else { - return redirect()->route('settings.list', [], false)->with([ + $route = route('settings.list', [], false); + return redirect($route) + ->with([ 'error' => __('app.alert.error.not_exist'), ]); } @@ -73,11 +75,15 @@ public function update(Request $request, $id) $setting->save(); - return redirect()->route('settings.index', [], false)->with([ + $route = route('settings.index', [], false); + return redirect($route) + ->with([ 'success' => __('app.alert.success.setting_updated'), ]); } else { - return redirect()->route('settings.index', [], false)->with([ + $route = route('settings.index', [], false); + return redirect($route) + ->with([ 'error' => __('app.alert.error.not_exist'), ]); } @@ -94,7 +100,9 @@ public function clear($id) $setting->value = ''; $setting->save(); } - return redirect()->route('settings.index', [], false)->with([ + $route = route('settings.index', [], false); + return redirect($route) + ->with([ 'success' => __('app.alert.success.setting_updated'), ]); diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 7749e14cc..aa0a48800 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -66,7 +66,8 @@ public function store(Request $request) //die(print_r($request->all())); Item::create($request->all()); - return redirect()->route('dash', [], false) + $route = route('dash', [], false); + return redirect($route) ->with('success', __('app.alert.success.tag_created')); } @@ -129,7 +130,8 @@ public function update(Request $request, $id) Item::find($id)->update($request->all()); - return redirect()->route('dash', [], false) + $route = route('dash', [], false); + return redirect($route) ->with('success',__('app.alert.success.tag_updated')); } @@ -151,7 +153,8 @@ public function destroy(Request $request, $id) Item::find($id)->delete(); } - return redirect()->route('tags.index', [], false) + $route = route('tags.index', [], false); + return redirect($route) ->with('success',__('app.alert.success.item_deleted')); } @@ -167,7 +170,8 @@ public function restore($id) Item::withTrashed() ->where('id', $id) ->restore(); - return redirect()->route('tags.index', [], false) + $route = route('tags.index', [], false); + return redirect($route) ->with('success',__('app.alert.success.item_restored')); }