fix routes

This commit is contained in:
KodeStar 2018-02-18 22:36:32 +00:00
parent c4f119de9c
commit 1f38de989b
3 changed files with 38 additions and 18 deletions

View file

@ -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'));
}

View file

@ -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'),
]);

View file

@ -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'));
}