Limit ownership to the given ability.

@param  string|string[]  $ability
@param  array  $attributes
@return void
972237
public function to($ability, array $attributes = [])
    {
        $this->ability = $ability;

        $this->attributes = array_merge($this->attributes, $attributes);
    }
1352513
public function setAttributes(array $attributes)
    {
        $this->attributes = [];
        foreach ($attributes as $attribute => $value) {
            $this->addAttribute($attribute, $value);
        }

        return $this;
    }
449297
public function setAttributes(array $attributes = [])
    {
        $this->attributes = array_merge($this->attributes, $attributes);
        isset($attributes['id']) ? $this->id         = $attributes['id'] : null;
        return $this;
    }
170164
protected function getModelAbilityKeys($abilities, $model, array $attributes)
    {
        $abilities = Collection::make(is_array($abilities) ? $abilities : [$abilities]);

        $models = Collection::make(is_array($model) ? $model : [$model]);

        return $abilities->map(function ($ability) use ($models, $attributes) {
            return $models->map(function ($model) use ($ability, $attributes) {
                return $this->getModelAbility($ability, $model, $attributes)->getKey();
            });
        })->collapse()->all();
    }
1345111
protected function findAbility($ability, $entity, $attributes)
    {
        $onlyOwned = isset($attributes['only_owned']) ? $attributes['only_owned'] : false;

        $query = Models::ability()
                     ->where('name', $ability)
                     ->forModel($entity, true)
                     ->where('only_owned', $onlyOwned);

        return Models::scope()->applyToModelQuery($query)->first();
    }
952056
public static function ownedVia($model, $attribute = null)
    {
        if (is_null($attribute)) {
            static::$ownership['*'] = $model;
        }

        static::$ownership[$model] = $attribute;
    }
993124
public function forbid($ability = null, $model = null)
    {
        if (is_null($ability)) {
            return new ForbidsAbilities($this);
        }

        (new ForbidsAbilities($this))->to($ability, $model);

        return $this;
    }
921199
protected function createMissingAbilities($existing, array $abilities, $attributes = [])
    {
        $missing = array_diff($abilities, $existing->pluck('name')->all());

        return array_map(function ($ability) use ($attributes) {
            return Models::ability()->create($attributes + ['name' => $ability]);
        }, $missing);
    }
387932
public function allowAttribute($attribute)
    {
        if (is_array($attribute))
        {
            foreach ($attribute as $attrib)
                $this->allowed_attributes[$attrib] = true;
        }
        else
            $this->allowed_attributes[$attribute] = true;
        return $this;
    }
65982
public function setAttributes(array $attributes = [])
    {
        $this->attributes = array_merge($this->attributes, $attributes);

        $this->validateAttributes();

        $this->decoupleOptionsFromAttributes();

        return $this;
    }
112797
public function complete($attributes)
    {
        foreach ($this->locked as $idx => $job) {
            if ($job['id'] == $attributes['id']) {
                unset($this->locked[$idx]);
                return;
            }
        }
    }
444793
protected function getModelAbility($ability, $entity, array $attributes)
    {
        $entity = $this->getEntityInstance($entity);

        $existing = $this->findAbility($ability, $entity, $attributes);

        return $existing ?: $this->createAbility($ability, $entity, $attributes);
    }
214599
public function setTitle($title, array $attributes)
    {
        if (! isset($attributes['title'])) {
            $attributes['title'] = $this->getQualifiedTitle($title);
        }

        return $attributes;
    }
31543
public function reset($attributes)
    {
        foreach ($this->failed as $idx => $job) {
            if ($job['id'] == $attributes['id']) {
                unset($this->failed[$idx]);
                break;
            }
        }

        foreach ($this->locked as $idx => $job) {
            if ($job['id'] == $attributes['id']) {
                unset($this->locked[$idx]);
                break;
            }
        }

        $attributes['status'] = 'free';
        array_unshift($this->queue, $attributes);
    }
845151
public function fill( array $attributes ) {
		foreach ( $attributes as $key => $value ) {
			if ( ! array_key_exists( $key, $this->attributes ) ) {
				continue;
			}

			$this->set_attribute( $key, $value );
		}

		return $this;
	}
850882
public function help($help, $attributes = [])
    {
        $this->help = $help;

        return parent::help($help, $attributes);
    }
617121
protected function enableLightbox(Attributes $attributes)
    {
        if (!$this->rel) {
            return;
        }

        if (strncmp($this->rel, 'lightbox', 8) !== 0) {
            $attributes->setAttribute('rel', $this->rel);
        } else {
            $attributes->setAttribute('data-lightbox', substr($this->rel, 9, -1));
        }
    }