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

41 lines
1.1 KiB
PHP

<?php
namespace App\Http\Controllers;
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);
}
}
}