neoban/backend/app/Actions/Chats/CreateChatAction.php
kushal-saha 8e2ced8bed Implement new JSON:API Resource for the api responses.
Implement Authentication States, show logout options in auth store and services.
Make DB and controllers to make messages grouped by chats.
Refactor backend code to use DTO.
2026-04-28 12:38:46 +00:00

17 lines
302 B
PHP

<?php
namespace App\Actions\Chats;
use App\Data\ChatResponseDto;
use App\Models\User;
class CreateChatAction
{
public function create(User $user, ?string $title = null)
{
$chat = $user->chats()->create(['title' => $title]);
return ChatResponseDto::fromModel($chat);
}
}