Register the model events for adding the slug.
430894
public static function bootSluggable()
    {
        static::created(function($model) {
            if ($model->shouldRunEvent($model, 'created')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
                $model->save();
            }
        });

        static::updating(function($model) {
            if ($model->shouldRunEvent($model, 'updating')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
            }
        });

        static::saving(function($model) {
            if ($model->shouldRunEvent($model, 'saving')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
            }
        });

    }
18587
def register_model(self, model):
        

        assert isinstance(model, str)
        if model not in self.all_models:
            self.all_models.append(model)
404328
def register_hook(self, event, hook):
        """"""

        if event not in self.hooks:
            raise ValueError('Unsupported event specified, with event name "%s"' % (event))

        if isinstance(hook, Callable):
            self.hooks[event].append(hook)
        elif hasattr(hook, '__iter__'):
            self.hooks[event].extend(h for h in hook if isinstance(h, Callable))
891018
private function add_slugify_helper() {
		$this->engine->addHelper(
			'slugify',
			function ( $template, $context, $args ) {
					$arg = $context->get( $args );
					return slugify( $arg );
			}
		);
	}
520195
function registerModel(model) {
  var name = model.getDebugName();
  var wrapped = flatRegistry.models[name] = new RegistryWrapper(model, 'models');
  if (typeof model.destroy === 'function') {
    wrapped.destroy = _.bind(model.destroy, model);
    model.destroy = _.bind(function() {
      var name = this.obj.getDebugName();
      delete flatRegistry.models[name];
      updateNestedModels();
      triggerChange();
      this.destroy();
    }, wrapped);
  }
  triggerChange();
}
418706
def register(self, name: str):
        ''''''
        if name in self._callbacks:
            raise ValueError('Hook already registered')

        self._callbacks[name] = None

        if self._event_dispatcher is not None:
            self._event_dispatcher.register(name)
234149
protected function registerEventSignals()
    {
        if (!EventLoop::$instance) {
            return;
        }
        foreach (self::$signals as $no => $name) {
            if ($name === 'SIGKILL' || $name == 'SIGSTOP') {
                continue;
            }

            $ev = EventLoop::$instance->signal($no, [$this, 'eventSighandler'], [$no]);
            if (!$ev) {
                $this->log('Cannot event_set for ' . $name . ' signal');
            }
            $ev->add();
            $this->sigEvents[$no] = $ev;
        }
    }
1173148
protected function registerModelContracts()
    {
        $this->app->bind(AdminUserInterface::class, AdminUserRepository::class);
        $this->app->bind(MenuInterface::class, MenuRepository::class);
        $this->app->bind(PageInterface::class, PageRepository::class);
        $this->app->bind(RoleInterface::class, RoleRepository::class);
        $this->app->bind(SiteCurrencyInterface::class, SiteCurrencyRepository::class);
    }
64392
def auto_slug_on_insert(mapper, connection, target):
    """"""
    if target.slug is None and target.name:
        target.slug = target.auto_slug
141370
protected function registerHooks()
    {
        // Our callbacks are registered only on the admin side even for guest and frontend callbacks
        if (is_admin())
        {
            switch ($this->accessType)
            {
                case 'guest':
                    Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
                    break;

                case 'logged':
                    Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax');
                    break;

                case 'any':
                    Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
                    Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax');
                    break;

                default:
                    throw new \InvalidArgumentException("Invalid value for the Ajax access type parameter: "
                        . $this->accessType);
            }
        }

        // If we have global variables
        Hooks::filter('baobab/ajax/global_data', $this, 'addGlobalVariables');
    }
620921
protected static function events()
    {
        foreach (self::fetch('app/events', false) as $file) {
            Bus::need($file);
        }
        //
        Event::register();
    }
1374475
private function registerEvents()
    {
        foreach ($this->getSetting('events', []) as $event => $listeners) {
            foreach ($listeners as $listener) {
                Event::bind($event, $listener);
            }
        }
    }
443704
def register_callbacks(self, on_create, on_modify, on_delete):
        
        self.on_create = on_create
        self.on_modify = on_modify
        self.on_delete = on_delete
875309
def subscribe_to_events(config, subscriber, events, model=None):
    
    kwargs = {}
    if model is not None:
        kwargs['model'] = model

    for evt in events:
        config.add_subscriber(subscriber, evt, **kwargs)
696730
protected function register()
    {
        // Make comment model for the factory.
        $this->setModel($this->makeCommentModel());

        // Build comment with model.
        $this->setSingularity($this->makeCommentInstance());

        // Set columns to the comment, after admin init.
        if ($this->methodExist('columns')) {
            $this->registerColumns();
        }
    }
338304
protected static function addEventHandlers()
    {
        $eventManager = EventManager::getInstance();

        foreach (static::$handlers as $module => $handlers) {
            foreach ($handlers as $event => $handler) {
                $eventManager->addEventHandler($module, $event, [__CLASS__, $handler], false, 5000);
            }
        }

        $eventManager->addEventHandler('main', 'OnAfterEpilog', function () {
            $notifier = new Notifier();
            $notifier->deleteNotificationFromPreviousMigration();

            return new EventResult();
        });
    }
1053473
protected function registerWhoops()
    {
        $whoops = new \Whoops\Run;
        $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
        $whoops->register();
    }