__set() public method

Dynamically set attributes on the model.
public __set ( string $key, mixed $value ) : void
$key string
$value mixed
return void
Example #1
0
 /**
  * {@inheritdoc}
  */
 public function __set($key, $value)
 {
     if (array_key_exists($key, $this->aliases)) {
         $key = $this->aliases[$key];
     }
     parent::__set($key, $value);
 }
Example #2
0
 public function __set($key, $value)
 {
     $columns = $this->getTableColumns();
     if ($this->hasSetMutator($key) || in_array($key, $this->getDates()) && $value || $this->isJsonCastable($key) && !is_null($value) || in_array($key, $columns)) {
         return parent::__set($key, $value);
     }
     $this->setMeta($key, $value);
 }
 /**
  * Set model's attribute
  * @param $method (eg 'setId')
  * @param $d
  * @return self
  */
 protected function set($method, $d)
 {
     $key = $this->match(lcfirst(substr($method, 3)));
     $this->model->__set($key, $d);
     return $this;
 }
Example #4
0
 /**
  * Dynamically set attributes.
  *
  * @param  string $key
  * @param  mixed $value
  * @return void
  */
 public function __set($key, $value)
 {
     // Dynamically set the encryptable attribute
     if (!empty($value) && $this->setDynamicEncryptable($key, $value)) {
         return;
     }
     // Fallback to the default Eloquent dynamic setter
     parent::__set($key, $value);
     // Dynamically juggle the attribute.
     $this->setDynamicJuggle($key, $value);
 }
Example #5
0
 /**
  * Mustard uses camel case for class properties, and snake case for database columns.
  *
  * @param string $property
  * @param mixed  $value
  */
 public function __set($property, $value)
 {
     parent::__set(snake_case($property), $value);
 }