]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/RecycleBinController.php
Added additional testing for editor switching permissions
[bookstack] / app / Http / Controllers / RecycleBinController.php
index 3126460080b62fea60f0cad128e72de74ed6269d..1cffb161cc8a3f94e68d8d6eaeb72ab2e10d7730 100644 (file)
@@ -1,4 +1,6 @@
-<?php namespace BookStack\Http\Controllers;
+<?php
+
+namespace BookStack\Http\Controllers;
 
 use BookStack\Actions\ActivityType;
 use BookStack\Entities\Models\Deletion;
@@ -7,7 +9,6 @@ use BookStack\Entities\Tools\TrashCan;
 
 class RecycleBinController extends Controller
 {
-
     protected $recycleBinBaseUrl = '/settings/recycle-bin';
 
     /**
@@ -19,11 +20,11 @@ class RecycleBinController extends Controller
         $this->middleware(function ($request, $next) {
             $this->checkPermission('settings-manage');
             $this->checkPermission('restrictions-manage-all');
+
             return $next($request);
         });
     }
 
-
     /**
      * Show the top-level listing for the recycle bin.
      */
@@ -32,6 +33,7 @@ class RecycleBinController extends Controller
         $deletions = Deletion::query()->with(['deletable', 'deleter'])->paginate(10);
 
         $this->setPageTitle(trans('settings.recycle_bin'));
+
         return view('settings.recycle-bin.index', [
             'deletions' => $deletions,
         ]);
@@ -56,17 +58,19 @@ class RecycleBinController extends Controller
                 $searching = false;
             }
         }
+
         /** @var ?Deletion $parentDeletion */
         $parentDeletion = ($currentDeletable === $deletion->deletable) ? null : $currentDeletable->deletions()->first();
 
         return view('settings.recycle-bin.restore', [
-            'deletion' => $deletion,
+            'deletion'       => $deletion,
             'parentDeletion' => $parentDeletion,
         ]);
     }
 
     /**
      * Restore the element attached to the given deletion.
+     *
      * @throws \Exception
      */
     public function restore(string $id)
@@ -77,6 +81,7 @@ class RecycleBinController extends Controller
         $restoreCount = (new TrashCan())->restoreFromDeletion($deletion);
 
         $this->showSuccessNotification(trans('settings.recycle_bin_restore_notification', ['count' => $restoreCount]));
+
         return redirect($this->recycleBinBaseUrl);
     }
 
@@ -95,6 +100,7 @@ class RecycleBinController extends Controller
 
     /**
      * Permanently delete the content associated with the given deletion.
+     *
      * @throws \Exception
      */
     public function destroy(string $id)
@@ -105,11 +111,13 @@ class RecycleBinController extends Controller
         $deleteCount = (new TrashCan())->destroyFromDeletion($deletion);
 
         $this->showSuccessNotification(trans('settings.recycle_bin_destroy_notification', ['count' => $deleteCount]));
+
         return redirect($this->recycleBinBaseUrl);
     }
 
     /**
      * Empty out the recycle bin.
+     *
      * @throws \Exception
      */
     public function empty()
@@ -118,6 +126,7 @@ class RecycleBinController extends Controller
 
         $this->logActivity(ActivityType::RECYCLE_BIN_EMPTY);
         $this->showSuccessNotification(trans('settings.recycle_bin_destroy_notification', ['count' => $deleteCount]));
+
         return redirect($this->recycleBinBaseUrl);
     }
 }