Пример #1
0
 public function __construct($target)
 {
     $this->target = $target;
     Event::listen('eloquent.created:*', function ($model) use($target) {
         if (get_class($model) == get_class($target)) {
             Tattler::room($this->getRoom())->say($this->tattlerCollectMessageBag($model, 'crud_create'));
         }
     });
     Event::listen('eloquent.updated:*', function ($model) use($target) {
         if (get_class($model) == get_class($target)) {
             Tattler::room($this->getRoom())->say($this->tattlerCollectMessageBag($model, 'crud_update'));
         }
     });
     Event::listen('eloquent.deleted:*', function ($model) use($target) {
         if (get_class($model) == get_class($target)) {
             Tattler::room($this->getRoom())->say($this->tattlerCollectMessageBag($model, 'crud_delete'));
         }
     });
 }
Пример #2
0
 protected function inject($widget)
 {
     if (isset($widget->model) && method_exists($widget->model, 'isClassExtendedWith')) {
         if ($widget->model->isClassExtendedWith('\\Grohman\\Tattler\\Lib\\Inject') == false) {
             $widget->model->extendClassWith('\\Grohman\\Tattler\\Lib\\Inject');
         }
         if (method_exists($widget, 'getColumns')) {
             $columns = $widget->model->getWidgetColumns($widget->getColumns());
         } else {
             $columns = $widget->model->getWidgetColumns();
         }
         if ($columns) {
             $room = Tattler::addRoom(get_class($widget->model));
             $room->allow();
             $user = Tattler::addUser(BackendAuth::getUser());
             $user->allow();
             $this->loadAssets($widget, Tattler::getDefaultRooms([$room->getName(), $user->getName()]));
         }
     }
 }
Пример #3
0
 /** Отправка socketId и листинга запрашиваемых комнат
  * @param Request $request
  * @return mixed
  */
 public function postIndex(Request $request)
 {
     return Tattler::getRooms($request->all());
 }