Mpociot\Teamwork\Traits\UsedByTeams::bootUsedByTeams PHP Метод

bootUsedByTeams() защищенный статический Метод

Boot the global scope
protected static bootUsedByTeams ( )
    protected static function bootUsedByTeams()
    {
        static::addGlobalScope('team', function (Builder $builder) {
            static::teamGuard();
            $builder->where($builder->getQuery()->from . '.team_id', auth()->user()->currentTeam->getKey());
        });
        static::saving(function (Model $model) {
            static::teamGuard();
            if (!isset($model->team_id)) {
                $model->team_id = auth()->user()->currentTeam->getKey();
            }
        });
    }