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

41 lines
1.1 KiB
PHP
Raw Normal View History

2024-08-30 06:16:16 +02:00
<?php
namespace App\Http\Controllers;
use App\Http\Requests\TrashGroupRequest;
use App\Services\UserTrashService;
class TrashUserController extends Controller
{
public function __construct(
private UserTrashService $userTrashService
2024-08-30 09:40:57 +02:00
) {}
2024-08-30 06:16:16 +02:00
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);
}
}
}