Git Product home page Git Product logo

talk's Introduction

Laravel-Talk

Talk is a Laravel 5 based user conversation (inbox) system. You can easily integrate this package with any laravel based project. Its help to you to develop a messeging system in 25 mins. So lets start :)

Talk Screenshot

Installation

Talk is a laravel package so you can install it via composer. write this code in your terminal from your project

composer require nahid/talk

Wait for a while, composer will be automatically install talk in your project.

Configuration

After downloading complete now you have to call this package service in config/app.php config file. So add this line in app.php providers section

Nahid\Talk\TalkServiceProvider::class,

To use facade you have to add these line in app.php aliases array

'Talk'      => Nahid\Talk\Facades\Talk::class,

Now run this command from your terminal to publish this package resources

php artisan vendor:publish --provider="Nahid\Talk\TalkServiceProvider"

After run this command all necessary file will be included with your project. This package has two default migrations. So you have to run migrate command like these. Make sure your database configuration was configure correctly.

php artisan migrate

Okay, now you have configure your user model for Talk. Go to config/talk.php and config it.

return [
    'user' => [
        'table' => 'your_users_table_name',
        'model' => 'User\Model',
        'columns' => ['column1', 'column2']
    ]
];

[NB: Here columns mean which column do you want for inbox query]

Usage

Its very easy to use. First you have set authenticate user id to Talk.

Talk::setAuthUserId(auth()->user()->id);

Now you may use any method what you need. Please see the API Doc.

API List

setAuthUserId

setAuthUserId method set the user id which you pass from parameter

Syntax

void setAuthUserId($userid)

isConversationExists

This method check currently logged in user and given user is already conversation

Syntax

int/false isConversationExists($userid)

isAuthenticUser

isAuthenticUser check the given user is exists in given conversation.

Syntax

boolean isAuthenticUser($conversationId, $userId)

sendMessage

You can send message via conversation id by using this method. If successfully send message it return Message model objects otherwise false

Syntax

object/false sendMessage($conversationId, $message)

sendMessageByUserId

You can send message via receiver id by using this method. If successfully send message it return Message model objects otherwise false

Syntax

object/false sendMessageByUserId($userId, $message)

getInbox

If you want to get all inbox this method may help you. This method get all inboxes via given user id

Syntax

object getInbox([$offset[, $take]])

getConversationsById

When you want to get all conversations by using your desire conversation id you can try it. This method return all conversations with users objects

Syntax

object getConversationsById($conversationId)

getConversationsByUserId

When you want to get all conversations by using your desire receiver id you can try it. This method return all conversations with users objects

Syntax

object getConversationsByUserId($receiverId)

getReceiverInfo

This method return all information about message receiver.

Syntax

object getReceiverInfo($conversationId)

makeSeen

If you want set a message as seen you can use it.

Syntax

boolean makeSeen($messageId)

deleteMessage

When you want to delete a specific message from conversation you have to use it. This method soft delete message for both user-end individually.

Syntax

boolean deleteMessage($messageId)

deleteForever

If you want to hard delete or permanently delete a specific message then you have to use this method

Syntax

boolean deleteForever($messageId)

deleteConversations

This method is used for permanently delete all conversations

Syntax

boolean deleteConversations($conversationId)

talk's People

Contributors

nahid avatar baileylo avatar

Watchers

James Cloos avatar Andrew Ben RICHARD avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.