Skip to content

A free open source IT asset/license management system

Remove unused route

snipe3c9649129515
diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php
index ddc4454e33..4dcf9a56f5 100755
--- a/app/Http/Controllers/LocationsController.php
+++ b/app/Http/Controllers/LocationsController.php
@@ -326,31 +326,26 @@ class LocationsController extends Controller
* @since [v1.0]
* @param int $id
*/
- public function postRestore($id) : RedirectResponse
+ public function postRestore(Location $location) : RedirectResponse
{
- $this->authorize('create', Location::class);
-
- if ($location = Location::withTrashed()->find($id)) {
-
- if ($location->deleted_at == '') {
- return redirect()->back()->with('error', trans('general.not_deleted', ['item_type' => trans('general.location')]));
- }
+ $this->authorize('delete', $location);
- if ($location->restore()) {
- $logaction = new Actionlog();
- $logaction->item_type = Location::class;
- $logaction->item_id = $location->id;
- $logaction->created_at = date('Y-m-d H:i:s');
- $logaction->created_by = auth()->id();
- $logaction->logaction('restore');
+ if ($location->deleted_at == '') {
+ return redirect()->back()->with('error', trans('general.not_deleted', ['item_type' => trans('general.location')]));
+ }
- return redirect()->route('locations.index')->with('success', trans('admin/locations/message.restore.success'));
- }
+ if ($location->restore()) {
+ $logaction = new Actionlog();
+ $logaction->item_type = Location::class;
+ $logaction->item_id = $location->id;
+ $logaction->created_at = date('Y-m-d H:i:s');
+ $logaction->created_by = auth()->id();
+ $logaction->logaction('restore');
- return redirect()->back()->with('error', trans('general.could_not_restore', ['item_type' => trans('general.location'), 'error' => $location->getErrors()->first()]));
+ return redirect()->route('locations.index')->with('success', trans('admin/locations/message.restore.success'));
}
- return redirect()->back()->with('error', trans('admin/models/message.does_not_exist'));
+ return redirect()->back()->with('error', trans('general.could_not_restore', ['item_type' => trans('general.location'), 'error' => $location->getErrors()->first()]));
}
diff --git a/routes/web/locations.php b/routes/web/locations.php
index 30bfbb87e3..882bd5c92d 100644
--- a/routes/web/locations.php
+++ b/routes/web/locations.php
@@ -18,7 +18,7 @@ Route::group(['prefix' => 'locations', 'middleware' => ['auth']], function () {
Route::post(
'{location}/restore',
[LocationsController::class, 'postRestore']
- )->name('locations.restore');
+ )->name('locations.restore')->withTrashed();
Route::get('{locationId}/clone',
[LocationsController::class, 'getClone']
diff --git a/routes/web/users.php b/routes/web/users.php
index d635562b5c..cfe66aeb4b 100644
--- a/routes/web/users.php
+++ b/routes/web/users.php
@@ -52,20 +52,12 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () {
)->name('users.clone.store')->withTrashed();
Route::post(
- '{userId}/restore',
+ '{user}/restore',
[
Users\UsersController::class,
'getRestore'
]
- )->name('users.restore.store');
-
- Route::get(
- '{userId}/unsuspend',
- [
- Users\UsersController::class,
- 'getUnsuspend'
- ]
- )->name('unsuspend/user');
+ )->name('users.restore.store')->withTrashed();
Route::post(
'{userId}/password',