public function changeOwnerTo(CanBeOwnerContract $owner)
    {
        $allowedOwnerType = $this->getOwnerModel();
        if (!$owner instanceof $allowedOwnerType) {
            throw InvalidOwnerType::notAllowed($this, $owner);
        }

        return $this->ownedBy()->associate($owner);
    }
public function changeOwnerTo(CanBeOwnerContract $owner)
    {
        $allowedOwnerType = $this->getOwnerModel();
        if (!$owner instanceof $allowedOwnerType) {
            throw InvalidOwnerType::notAllowed($this, $owner);
        }

        return $this->ownedBy()->associate($owner);
    }
public function changeOwnerTo ( CanBeOwnerContract $ owner ) { $ allowedOwnerType = $ this -> getOwnerModel ( ) ; if ( ! $ owner instanceof $ allowedOwnerType ) { throw InvalidOwnerType :: notAllowed ( $ this , $ owner ) ; } return $ this -> ownedBy ( ) -> associate ( $ owner ) ; }
Changes owner of the model.

@param \Cog\Contracts\Ownership\CanBeOwner $owner
@return $this

@throws \Cog\Contracts\Ownership\Exceptions\InvalidOwnerType
Changes owner of the model .