@@ -106,8 +106,9 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | foreach ($changedValues as $attribute => $value) { |
| 108 | 108 | |
| 109 | - if ($this->skipOnNull && $value === null || $attribute == $this->timestampAttribute) |
|
| 110 | - continue; |
|
| 109 | + if ($this->skipOnNull && $value === null || $attribute == $this->timestampAttribute) { |
|
| 110 | + continue; |
|
| 111 | + } |
|
| 111 | 112 | |
| 112 | 113 | if(!$this->isAuthorised($user, $attribute, $value)){ |
| 113 | 114 | $this->createConfirmationRequest(); |
@@ -127,15 +128,17 @@ discard block |
||
| 127 | 128 | protected function isAuthorised($user, $attribute, $value){ |
| 128 | 129 | |
| 129 | 130 | //Check for pre-defined administration roles |
| 130 | - if ($this->userIsAuthorised($user)) |
|
| 131 | - return true; |
|
| 131 | + if ($this->userIsAuthorised($user)) { |
|
| 132 | + return true; |
|
| 133 | + } |
|
| 132 | 134 | |
| 133 | 135 | //Check for valid release token , eg that the token exists and is for the same record as this |
| 134 | 136 | if($this->releaseToken != null){ |
| 135 | 137 | $confirmation = ConfirmationRequest::findOne(['release_token' => $this->releaseToken]); |
| 136 | 138 | |
| 137 | - if($confirmation == null) |
|
| 138 | - return false; |
|
| 139 | + if($confirmation == null) { |
|
| 140 | + return false; |
|
| 141 | + } |
|
| 139 | 142 | |
| 140 | 143 | $model = $confirmation->constructObject(); |
| 141 | 144 | |
@@ -144,9 +147,10 @@ discard block |
||
| 144 | 147 | } |
| 145 | 148 | |
| 146 | 149 | //Check to see if any protected attributes have been altered |
| 147 | - foreach ($this->protectedAttributes as $attribute) |
|
| 148 | - if($this->hasChanged($attribute)) |
|
| 150 | + foreach ($this->protectedAttributes as $attribute) { |
|
| 151 | + if($this->hasChanged($attribute)) |
|
| 149 | 152 | return false; |
| 153 | + } |
|
| 150 | 154 | |
| 151 | 155 | return true; |
| 152 | 156 | } |
@@ -158,9 +162,10 @@ discard block |
||
| 158 | 162 | * @return bool |
| 159 | 163 | */ |
| 160 | 164 | protected function userIsAuthorised($user){ |
| 161 | - foreach ($this->allow as $role) |
|
| 162 | - if($user->can($role)) |
|
| 165 | + foreach ($this->allow as $role) { |
|
| 166 | + if($user->can($role)) |
|
| 163 | 167 | return true; |
| 168 | + } |
|
| 164 | 169 | |
| 165 | 170 | return false; |
| 166 | 171 | } |
@@ -204,9 +209,10 @@ discard block |
||
| 204 | 209 | public function getChangedValues(){ |
| 205 | 210 | $changedAttributes = []; |
| 206 | 211 | |
| 207 | - foreach ($this->owner->attributes() as $attribute) |
|
| 208 | - if($this->hasChanged($attribute)) |
|
| 212 | + foreach ($this->owner->attributes() as $attribute) { |
|
| 213 | + if($this->hasChanged($attribute)) |
|
| 209 | 214 | $changedAttributes[$attribute] = $this->owner->$attribute; |
| 215 | + } |
|
| 210 | 216 | |
| 211 | 217 | unset($changedAttributes[$this->timestampAttribute]); |
| 212 | 218 | |