hasSetMutator() публичный Метод

Determine if a set mutator exists for an attribute.
public hasSetMutator ( string $key ) : boolean
$key string
Результат boolean
Пример #1
0
 public function hasSetMutator($key)
 {
     if ($this->autohash_attributes) {
         foreach ($this->attributes_schema as $k => $value) {
             if ($value == 'hashed' && $k == $key) {
                 return true;
             }
         }
     }
     if ($this->autoserialize_attributes) {
         foreach ($this->attributes_schema as $k => $value) {
             if ($value == 'array' && $k == $key || $value == 'object' && $k == $key) {
                 return true;
             }
         }
     }
     return parent::hasSetMutator($key);
 }
Пример #2
0
 /**
  * Syncs the models password with the specified password.
  *
  * @param Model  $model
  * @param string $password
  *
  * @return Model
  */
 protected function syncModelPassword(Model $model, $password)
 {
     // If the developer doesn't want to synchronize AD passwords,
     // we'll set the password to a random 16 character string.
     $password = $this->getPasswordSync() ? $password : str_random();
     // If the model has a set mutator for the password then
     // we'll assume that the dev is using their own
     // encryption method for passwords. Otherwise
     // we'll bcrypt it normally.
     $model->password = $model->hasSetMutator('password') ? $password : bcrypt($password);
     return $model;
 }