|
|
@ -3,8 +3,10 @@ |
|
|
|
namespace App\Listeners; |
|
|
|
|
|
|
|
use App\Events\ModelSaved; |
|
|
|
use App\Notifications\SocketNotification; |
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue; |
|
|
|
use Illuminate\Queue\InteractsWithQueue; |
|
|
|
use Illuminate\Support\Facades\Notification; |
|
|
|
|
|
|
|
class NotifHandler |
|
|
|
{ |
|
|
@ -29,8 +31,12 @@ class NotifHandler |
|
|
|
$message = json_decode($event->message); |
|
|
|
$event_class = 'App\Events\\'.enum('tables.'.$message->data->table_name.'.singular_name').enum('cruds.inverse.'.$message->data->crud_id.'.name'); |
|
|
|
if (class_exists($event_class)) { |
|
|
|
// event(new ('App\Events\\'.$event_class($message)));
|
|
|
|
$event_class::dispatch($message); |
|
|
|
} |
|
|
|
Notification::send(auth()->user(), new SocketNotification( |
|
|
|
[ |
|
|
|
'message' => enum('tables.'.$message->data->table_name.'.singular_name').enum('cruds.inverse.'.$message->data->crud_id.'.name'), |
|
|
|
'payload'=>$business_info |
|
|
|
])); |
|
|
|
} |
|
|
|
} |