/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $events->listen(eloquent_event(Topic::class, Event::SAVING), class_callback(self::class, 'onSaving')); }
/** * 注册监听器给订阅者。. * * @param \Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $events->listen(TopicUpVoted::class, class_callback(self::class, 'handle')); $events->listen(NewReply::class, class_callback(self::class, 'handle')); }