This package the basic architecture of a chat between multiple users.
You can install the package via composer:
composer require elegantly/laravel-conversations
You can publish and run the migrations with:
php artisan vendor:publish --tag="conversations-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="conversations-config"
This is the contents of the published config file:
return [
/**
* The Model used with the user_id and owner_id
*/
'model_user' => User::class,
'model_message' => Message::class,
'model_conversation' => Conversation::class,
/**
* When a User is deleted, his messages will be deleted
*/
'cascade_user_delete_to_messages' => false,
/**
* When a User is deleted, his messages will be deleted
*/
'cascade_conversation_delete_to_messages' => false,
/**
* When the parent of a conversation is deleted, the conversation is deleted
*/
'cascade_conversationable_delete_to_conversation' => false,
];
$conversation = new Conversation();
$conversation->conversationable()->associate($mission); // optional
$conversation->save();
$conversation->users()->sync($usersIds);
$message = new Message([
'content' => "My message",
]);
$message->user()->associate($this->user);
$this->conversation->messages()->save($message);
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.