All Projects β†’ akiyamaSM β†’ Messager

akiyamaSM / Messager

A convenient way to handle messages between users in a simple way

Projects that are alternatives of or similar to Messager

Laravel Queue
Laravel Enqueue message queue extension. Supports AMQP, Amazon SQS, Kafka, Google PubSub, Redis, STOMP, Gearman, Beanstalk and others
Stars: ✭ 155 (+5.44%)
Mutual labels:  laravel, messaging
Speedy
πŸš„A Laravel Admin Package to create a website quickly
Stars: ✭ 146 (-0.68%)
Mutual labels:  laravel
Youtube
Upload a video to a single YouTube channel with Laravel 5.
Stars: ✭ 143 (-2.72%)
Mutual labels:  laravel
Laravel Ide Helper
Laravel IDE Helper
Stars: ✭ 11,893 (+7990.48%)
Mutual labels:  laravel
Laravel Themer
Multi theme support for Laravel application
Stars: ✭ 142 (-3.4%)
Mutual labels:  laravel
Flarum
Simple forum software for building great communities.
Stars: ✭ 12,190 (+8192.52%)
Mutual labels:  laravel
Laravel Mailable Test
An artisan command to easily test mailables
Stars: ✭ 143 (-2.72%)
Mutual labels:  laravel
Laravel Disposable Email
Disposable email address validator for Laravel
Stars: ✭ 147 (+0%)
Mutual labels:  laravel
Laravel Emoji
πŸ˜„ This package assist you in getting started with emoji easily.
Stars: ✭ 146 (-0.68%)
Mutual labels:  laravel
Laravue
Admin dashboard for enterprise Laravel applications built by VueJS and Element UI https://laravue.dev
Stars: ✭ 1,964 (+1236.05%)
Mutual labels:  laravel
Translug
δΈ­ζ–‡ηš„ url slug ζ”―ζŒ
Stars: ✭ 145 (-1.36%)
Mutual labels:  laravel
Array Redactor
A PHP package to redact array values by their keys.
Stars: ✭ 144 (-2.04%)
Mutual labels:  laravel
Laravel Nuxt Js
Build a SPA with Laravel and Nuxt.
Stars: ✭ 146 (-0.68%)
Mutual labels:  laravel
Laravel Auth0
Laravel plugin for Auth0
Stars: ✭ 143 (-2.72%)
Mutual labels:  laravel
Technicsolder
PHP web app that brings incremental pack updates to the Technic Launcher and Technic Platform
Stars: ✭ 146 (-0.68%)
Mutual labels:  laravel
Nservicebus
The most popular service bus for .NET
Stars: ✭ 1,816 (+1135.37%)
Mutual labels:  messaging
Laravel Rethinkdb
RethinkDB adapter for Laravel (with Eloquent support)
Stars: ✭ 144 (-2.04%)
Mutual labels:  laravel
Jsqmessagesviewcontroller
An elegant messages UI library for iOS
Stars: ✭ 11,240 (+7546.26%)
Mutual labels:  messaging
Grosir Obat
Sebuah sistem kasir dan manajemen produk obat untuk penjualan Grosir
Stars: ✭ 147 (+0%)
Mutual labels:  laravel
Lms Laravel
Laravel Learning Management System (LMS)
Stars: ✭ 148 (+0.68%)
Mutual labels:  laravel

(NOT MAINTAINED)

Laravel Messager

A convenient way to handle messages between users in a simple way

Table of Contents

  1. Installation
  2. Setup a Model
  3. Creating & Sending Messages
    1. Creating a message
    2. Sending the message
    3. Responding the message
    4. Drafting a message
  4. Working with Messages
    1. Getting messages between users
    2. Read messages
    3. Unread messages
    4. Draft messages
  5. Tags
    1. Create and Edit tags
    2. Assign tag to message
    3. Change and get tag of a message
    4. Remove a tag from a message

Installation:

First, install the package through Composer.

composer require inani/messager

Then include the service provider inside config/app.php.

'providers' => [
    ...
    Inani\Messager\MessagerServiceProvider::class,
    ...
];

Publish config and migrations

php artisan vendor:publish

Setup a Model

To setup a model all you have to do is add (and import) the MessageAccessible trait.

use Inani\Messager\Helpers\MessageAccessible;
use Inani\Messager\Helpers\TagsCreator;
class User extends Model
{
    use MessageAccessible, TagsCreator;
    ...
}

Creating & sending Messages

Creating a message

$receiver = User::find(1); 

// Message Data
$messageData = [
	'content' => 'Hello all this is just a test', // the content of the message
	'to_id' => $receiver->getKey(), // Who should receive the message
];

list($message, $user) = App\User::createFromRequest($messageData);

Sending the message

$sender = User::find(2);

$sent = $sender->writes($message)
                 ->to($user)
                 ->send();
		 
// send to multiple users the same message
// can execpt a user|array of users| array of ids| or array of users and ids
$sent = $sender->writes($message)
                 ->to($user)
		 ->cc([$user1, $user2])
		 ->cc([$user3->id, $user4->id])
                 ->send();

Responding the message

$sender = User::find(2);

$sent = $user->writes($newMessage)
                 ->to($sender)
		 ->responds($message)
                 ->send();

Drafting a message

$sender = User::find(2);

$draft = $sender->writes($message)
                  ->to($user)
                  ->draft()
                  ->keep();

Working with Messages

Once you've got messages you need to do something with them.

Getting messages between users

// Users
$userA = App\User::find(1);
$userB = App\User::find(2);

// Get seen messages sent from UserB to UserA
$messages = $userA->received()->from($userB)->seen()->get();

// OR you can pass an array of IDs 
$messages = $userA->received()->from([2, 3, 4, 5])->seen()->get();

Read messages

// Set the selected message(or id of messages as read)
$count = $userB->received()->select($message)->readThem();

Unread messages

// Get unread messages from UserB to User A
$messages = $userA->received()->from($userB)->unSeen()->get();

// Marking them as read
$messages = $userA->received()->from($userB)->unSeen()->readThem();

// check out if a conversation has new messages
$bool = $userA->received()->conversation($message)->hasNewMessages();

// Get the number of conversations that have new messages in it
$number = $userA->received()->unSeenConversations();

Sent messages

// Get unread messages from UserA to UserB
$messages = $userA->sent()->to($userB)->get();

// OR you can pass an array of IDs
$messages = $userA->received()->to([2, 3, 4, 5)->get();

Draft messages

// Get the draft messages for UserA
$messages = $userA->sent()->inDraft()->get().

Tags

You can tag (or structure your messages in different categories).

Create and Edit tags

each user can make any number of tags.

// create a new tag, $data can be (Tag instance, array, Request)
$tag = $userA->addNewTag($data);

// Modify the attributes of a tag
$user->tag($tag)->name("social")->color("#ffff")->apply();

Assign tag to message

Once you have the message and the tag

// you'll need the instance of user(to check if sender or receiver)
// $user and $tag can be ids or instance of User, Tag classes
$bool = $message->concerns($user)->putTag($tag);

Change and get tag of a message

// to change the tag just use the same method
$bool = $message->concerns($user)->putTag($tag);

// to get the tag of the message, null if not tagged
$tagOrNull = $message->concerns($user)->getTag();
// 

Remove a tag from a message

// To remove the tag from the message
$bool = $message->concerns($user)->removeTag();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].