diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 6efbd31e..f087c26e 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -49,7 +49,8 @@ class ItemController extends Controller $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 @@ class ItemController extends Controller $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 @@ class ItemController extends Controller $data['ajax'] = true; return view('sortable', $data); } else { - return redirect()->route('dash', [], false); - } + $route = route('dash', [], false); + return redirect($route); + } } @@ -151,7 +154,8 @@ class ItemController extends Controller $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 @@ class ItemController extends Controller $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 @@ class ItemController extends Controller } 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 @@ class ItemController extends Controller // 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 c37e2483..843e2de0 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -39,7 +39,9 @@ class SettingsController extends Controller '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 @@ class SettingsController extends Controller $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 @@ class SettingsController extends Controller $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 7749e14c..aa0a4880 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -66,7 +66,8 @@ class TagController extends Controller //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 @@ class TagController extends Controller 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 @@ class TagController extends Controller 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 @@ class TagController extends Controller 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')); }