codegor/laravel-vuex-resapi

A laravel part of Vuex-laravel-resource-api for web socket events.

dev-master 2019-09-16 13:20 UTC

This package is auto-updated.

Last update: 2024-04-17 00:02:54 UTC


README

Laravel Source Build Status License Total Downloads

This is a laravel event part of Vuex API library for Laravel REST Controller, with model example. When you want to use Laravel Echo with vuex-laravel-resource-api this is a backend for broadcasting event of Laravel Echo.

How to use?

In a model at the boot section you can emmit WS event for Resapi.

Like this:

//...
use Codegor\Resapi\Events\UpdateData;

class Manager extends Model {
    protected static function boot() {
      // ...
      static::saved(function($m){broadcast(new UpdateData('manager', $m->user_id))->toOthers();});  
    }
    
    // ...
}

See example/Manager.php for fool example.