megahunt.test/app/Http/Controllers/TrashUserController.php

49 lines
1.2 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Http\Requests\AuthorizedRequest;
use App\Http\Requests\TrashGroupRequest;
use App\Services\UserTrashService;
class TrashUserController extends Controller
{
public function __construct(
private UserTrashService $userTrashService
) {
}
public function addMultiple(TrashGroupRequest $request)
{
$ids = $request->getValidatedIds();
$ret = $this->userTrashService->moveUsersToTrash($ids);
if (is_array($ret)) {
return response()->json($ret, 404);
}
}
public function deleteMultiple(TrashGroupRequest $request)
{
$ids = $request->getValidatedIds();
$ret = $this->userTrashService->moveUsersFromTrash($ids);
if (is_array($ret)) {
return response()->json($ret, 404);
}
}
public function cleanMultiple(TrashGroupRequest $request)
{
$ids = $request->getValidatedIds();
$ret = $this->userTrashService->cleanUsersFromTrash($ids);
if (is_array($ret)) {
return response()->json($ret, 404);
}
}
public function list(AuthorizedRequest $request)
{
return $this->userTrashService->listUsersInTrash();
}
}