<?php

namespace App\Http\Controllers;

use App\Models\User;
use App\Http\Resources\UserResource;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;

class UserController extends Controller
{
    /**
     * Display a listing of all users except the authenticated one.
     */
    public function index(Request $request): AnonymousResourceCollection
    {
        // On retourne tous les utilisateurs sauf soi-même pour faciliter la création de conversations
        $users = User::all();

        return UserResource::collection($users);
    }
}
