sasin91/laravel-conversations

Enables User conversations in a Laravel 5 app!

dev-master 2018-01-17 09:47 UTC

This package is auto-updated.

Last update: 2024-03-12 02:44:32 UTC


README

Contents

Installation

For Laravel ~5

composer require sasin91/laravel-conversations

As with any package, it's a good idea to refresh composer autoloader.

composer dump-autoload

Configuration

To publish conversable.php config file, run the following, vendor:publish command.

php artisan vendor:publish --provider="\Sasin91\LaravelConversations\ConversableServiceProvider"

You may configure the config file to your liking, however the defaults should work for most cases.

Overriding models

You can override the default models permanently in the published config file. Temporarily by setting the config value at runtime.

    config()->set('conversable.models.user', User::class);

additionally, as a convenience there are also config objects available, taking models as example:

    \Sasin91\LaravelConversations\Config\Models::swap('user', User::class);

Swapping the InvitationCode

You may rebind the concrete of the InvitationCode in your service provider.

    $this->app->singleton(\Sasin91\LaravelConversations\InvitationCode::class, Concrete::class);

as a convenience, the contract defines __invoke method to be defined, which means it's possible to use a \Closure for the implementation.

Policy filters

You may register global within scope of this package policy callbacks in your service provider,

\Sasin91\LaravelConversations\Config\Policies::before(function ($user, $ability) {
    // return boolean
});

\Sasin91\LaravelConversations\Config\Policies::after(function ($user, $ability) {
    // return boolean
});

And you are ready to go.

Usage

This package provides the Eloquent portion plus some policies of a Conversations implementation.

Events

The common eloquent events are available as usual.

Additionally, when an invitation is accepted & declined the following events are dispatched.

		'accepted' => 'Sasin91\LaravelConversations\Events\InvitationAccepted',
		'declined' => 'Sasin91\LaravelConversations\Events\InvitationDeclined'

Issues

If you discover any vulnerabilities, please e-mail them to me at jonas.kerwin.hansen@gmail.com.

For issues, open a issue on Github.

I'm currently aware of issues with proxy-driver-commands and testing.

License

laravel-conversations is free software distributed under the terms of the MIT license.