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

33 lines
753 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
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
) { }
public function list(AuthorizedRequest $request)
{
return $this->userService->listAll();
}
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);
}
}
}