1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Apply fixes from StyleCI

This commit is contained in:
Dan Brown
2021-06-26 15:23:15 +00:00
committed by StyleCI Bot
parent 3a402f6adc
commit 934a833818
349 changed files with 3655 additions and 2625 deletions

View 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,
]);
@ -60,13 +62,14 @@ class RecycleBinController extends Controller
$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 +80,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 +99,7 @@ class RecycleBinController extends Controller
/**
* Permanently delete the content associated with the given deletion.
*
* @throws \Exception
*/
public function destroy(string $id)
@ -105,11 +110,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 +125,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);
}
}