/** * Used to set model's owner without all the checks and audit logs. * Used in event handling code for queues. * @param User $user */ public function setOwnerUnrestricted(User $user) { parent::unrestrictedSet('owner', $user); }
protected function ownerChange($newOwnerValue) { $this->checkPermissionsHasAnyOf(Permission::CHANGE_OWNER); $this->isSetting = true; try { if (!$this->isSaving) { AuditUtil::saveOriginalAttributeValue($this, 'owner', $newOwnerValue); } parent::unrestrictedSet('owner', $newOwnerValue); $this->isSetting = false; } catch (Exception $e) { $this->isSetting = false; throw $e; } }