src/BoomCMS/Observers/SetSiteObserver.php
public function creating(Model $model)
    {
        if ($model instanceof SingleSiteInterface) {
            $site = $this->router->getActiveSite() ?: $this->site->findDefault();

            $model->{SingleSiteInterface::ATTR_SITE} = ($site ? $site->getId() : null);
        }
    }
public function creating(Model $model)
    {
        if ($model instanceof SingleSiteInterface) {
            $site = $this->router->getActiveSite() ?: $this->site->findDefault();

            $model->{SingleSiteInterface::ATTR_SITE} = ($site ? $site->getId() : null);
        }
    }
public function creating ( Model $ model ) { if ( $ model instanceof SingleSiteInterface ) { $ site = $ this -> router -> getActiveSite ( ) ? : $ this -> site -> findDefault ( ) ; $ model -> { SingleSiteInterface :: ATTR_SITE } = ( $ site ? $ site -> getId ( ) : null ) ; } }
Set the site_id of the model.

If a site is currently active then it is used, otherwise the default site is used.

@param Model $model

@return void
Set the site_id of the model .