Skip to content

Commit

Permalink
fix routes
Browse files Browse the repository at this point in the history
  • Loading branch information
KodeStar authored and KodeStar committed Feb 18, 2018
1 parent c4f119d commit 1f38de9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
28 changes: 18 additions & 10 deletions app/Http/Controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}
}


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

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

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

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

Expand Down
16 changes: 12 additions & 4 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]);
}
Expand Down Expand Up @@ -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'),
]);
}
Expand All @@ -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'),
]);

Expand Down
12 changes: 8 additions & 4 deletions app/Http/Controllers/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

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

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

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

Expand Down

0 comments on commit 1f38de9

Please sign in to comment.