composer require khonik/chats
Khonik\Chats\Providers\ChatsServiceProvider::class
php artisan vendor:publish --provider="Khonik\Chats\Providers\ChatsServiceProvider"
php artisan migrate
use Chatable
{"user_id":2}
{
"status": "success",
"chat": {
"updated_at": "2022-01-13T12:17:16.000000Z",
"created_at": "2022-01-13T12:17:16.000000Z",
"id": 2
}
}
{
"status": "success",
"chats": [
{
"id": 2,
"created_at": "2022-01-13T12:17:16.000000Z",
"updated_at": "2022-01-13T12:17:16.000000Z",
"new_messages_count": 0,
"pivot": {
"user_id": 1,
"chat_id": 2,
"last_opened_at": null
},
"target_user": {
"id": 2,
"name": "Ira",
"username": "IrSink",
"avatar": "http://localhost/storage/1641842698-cnr.png",
"lat": 55.777216,
"lon": 37.52706,
"status": "online",
"laravel_through_key": 2
},
"last_message": null
}
],
"total": 3
}
{
"status": "success",
"chats": [
{
"id": 2,
"created_at": "2022-01-13T12:17:16.000000Z",
"updated_at": "2022-01-13T12:17:16.000000Z",
"new_messages_count": 0,
"pivot": {
"user_id": 1,
"chat_id": 2,
"last_opened_at": null
},
"target_user": {
"id": 2,
"name": "Ira",
"username": "IrSink",
"avatar": "http://localhost/storage/1641842698-cnr.png",
"lat": 55.777216,
"lon": 37.52706,
"status": "online",
"laravel_through_key": 2
},
"last_message": null
}
],
"total": 3
}
{
"status": "success",
"messages": [
{
"id": 1,
"chat_id": 2,
"user_id": 2,
"type": "text",
"body": "Чего молчим?(",
"created_at": "2022-01-13T12:18:32.000000Z",
"updated_at": "2022-01-13T12:18:32.000000Z",
"author": {
"id": 2,
"name": "Ira",
"username": "IrSink",
"avatar": "http://localhost/storage/1641842698-cnr.png",
"lat": 55.777216,
"lon": 37.52706,
"status": "online"
}
}
],
"total": 1
}
{
"type":"text",
"body":"Чего молчим?("
}
{
"status": "success",
"message": {
"chat_id": "2",
"type": "text",
"body": "Чего молчим?(",
"user_id": 2,
"updated_at": "2022-01-13T12:18:32.000000Z",
"created_at": "2022-01-13T12:18:32.000000Z",
"id": 1
}
}
{
"type":"text",
"body":"Чего молчим?("
}
{
"status": "success",
"message": {
"chat_id": "2",
"type": "text",
"body": "Чего молчим?(",
"user_id": 2,
"updated_at": "2022-01-13T12:18:32.000000Z",
"created_at": "2022-01-13T12:18:32.000000Z",
"id": 1
}
}
{
"status": "success",
}