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

41 lines
972 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
use App\Facade\Filters\Filters;
use App\Http\Requests\AuthorizedRequest;
2024-08-30 03:31:22 +02:00
use App\Http\Requests\UserEditRequest;
use App\Services\UserService;
class PrivateUserController extends Controller
{
public function __construct(
private UserService $userService
2024-08-30 09:40:57 +02:00
) {}
2024-08-30 09:37:24 +02:00
public function list(AuthorizedRequest $request)
{
return $this->userService->listAll();
}
public function listFilters(AuthorizedRequest $request)
{
$filters = Filters::fromArrayOrObject($request->all());
2024-08-30 09:40:57 +02:00
return $this->userService->listAll($filters);
}
public function get(AuthorizedRequest $request, string $id)
{
return $this->userService->getOneById($id);
}
2024-08-30 03:31:22 +02:00
public function edit(UserEditRequest $request, string $id)
{
$user = $this->userService->editUser($request->all(), $id);
if ($user === null) {
return response('', 404);
}
}
}