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.
17 lines
302 B
PHP
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);
|
|
}
|
|
}
|