codegor / laravel-vuex-resapi
A laravel part of Vuex-laravel-resource-api for web socket events.
dev-master
2019-09-16 13:20 UTC
Requires
- php: >=7.0
- laravel/framework: ^5.6
This package is auto-updated.
Last update: 2024-11-17 01:15:21 UTC
README
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.