neoban/backend/app/Actions/Chats/GetUserChatsAction.php
kushal-saha ad0f0bf67b feature(chat): implement sidebar, chat listing, and improved chat handling
- Added `Sidebar` component with responsive layout for chat navigation.
- Implemented `ChatStore` for managing chat data and fetching user chats.
- Integrated JSON:API `ChatCollection` for consistent backend responses.
- Added `GetUserChatsAction` to retrieve paginated user chats.
- Refactored frontend to separate `ChatStore` and `MessageStore` for improved state management.
- Updated styles, components, and tests for seamless chat interactions.
2026-04-30 13:06:47 +00:00

19 lines
459 B
PHP

<?php
namespace App\Actions\Chats;
use App\Data\Chats\ChatResponseDto;
use App\Models\User;
use Illuminate\Pagination\AbstractPaginator;
use Illuminate\Pagination\LengthAwarePaginator;
final readonly class GetUserChatsAction
{
public function chats(User $user): LengthAwarePaginator|AbstractPaginator
{
$chats = $user->chats()->latest()->paginate();
return $chats->through(fn ($chat) => ChatResponseDto::fromModel($chat));
}
}