Skip to content

Commit

Permalink
feat: add logic for team
Browse files Browse the repository at this point in the history
  • Loading branch information
deniskorbakov committed Oct 26, 2024
1 parent 2b024ad commit b9281b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Http/Controllers/Api/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Http\Controllers\Api;

use App\DTO\Api\User\Request\UserUpdateDTO;
use App\Models\Team;
use App\Models\User;
use App\Services\Api\UserService;
use Illuminate\Http\JsonResponse;
Expand All @@ -26,11 +27,13 @@ public function update(int $id, UserUpdateDTO $userUpdateDTO): array|JsonRespons
$user = User::query()->findOrFail($id);

return $this->userService->update($user, $userUpdateDTO);

}

public function team()
public function team(int $id): array
{
$teams = User::query()->findOrFail($id)?->teams()->get();

return $this->userService->team($teams);
}

public function challenge()
Expand Down

0 comments on commit b9281b3

Please sign in to comment.