<?php namespace BookStack\Http\Controllers;
-use BookStack\Entities\Deletion;
-use BookStack\Entities\Managers\TrashCan;
+use BookStack\Actions\ActivityType;
+use BookStack\Entities\Models\Deletion;
+use BookStack\Entities\Tools\TrashCan;
class RecycleBinController extends Controller
{
*/
public function __construct()
{
- // TODO - Check this is enforced.
$this->middleware(function ($request, $next) {
$this->checkPermission('settings-manage');
$this->checkPermission('restrictions-manage-all');
return $next($request);
});
- parent::__construct();
}
{
$deletions = Deletion::query()->with(['deletable', 'deleter'])->paginate(10);
+ $this->setPageTitle(trans('settings.recycle_bin'));
return view('settings.recycle-bin.index', [
'deletions' => $deletions,
]);
{
/** @var Deletion $deletion */
$deletion = Deletion::query()->findOrFail($id);
+ $this->logActivity(ActivityType::RECYCLE_BIN_RESTORE, $deletion);
$restoreCount = (new TrashCan())->restoreFromDeletion($deletion);
$this->showSuccessNotification(trans('settings.recycle_bin_restore_notification', ['count' => $restoreCount]));
{
/** @var Deletion $deletion */
$deletion = Deletion::query()->findOrFail($id);
+ $this->logActivity(ActivityType::RECYCLE_BIN_DESTROY, $deletion);
$deleteCount = (new TrashCan())->destroyFromDeletion($deletion);
$this->showSuccessNotification(trans('settings.recycle_bin_destroy_notification', ['count' => $deleteCount]));
*/
public function empty()
{
- $deleteCount = (new TrashCan())->destroyFromAllDeletions();
+ $deleteCount = (new TrashCan())->empty();
+ $this->logActivity(ActivityType::RECYCLE_BIN_EMPTY);
$this->showSuccessNotification(trans('settings.recycle_bin_destroy_notification', ['count' => $deleteCount]));
return redirect($this->recycleBinBaseUrl);
}