Skip to content

Commit f2f1d4d

Browse files
committed
Return $this in set_attribute
1 parent 3a46721 commit f2f1d4d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

laravel/database/eloquent/model.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ public function timestamp()
441441
}
442442

443443
/**
444-
*Updates the timestamp on the model and immediately saves it.
444+
* Updates the timestamp on the model and immediately saves it.
445445
*
446446
* @return void
447447
*/
@@ -562,11 +562,12 @@ public function get_attribute($key)
562562
*
563563
* @param string $key
564564
* @param mixed $value
565-
* @return void
565+
* @return Model
566566
*/
567567
public function set_attribute($key, $value)
568568
{
569569
$this->attributes[$key] = $value;
570+
return $this;
570571
}
571572

572573
/**
@@ -769,8 +770,7 @@ public function __call($method, $parameters)
769770
}
770771
elseif (starts_with($method, 'set_'))
771772
{
772-
$this->set_attribute(substr($method, 4), $parameters[0]);
773-
return $this;
773+
return $this->set_attribute(substr($method, 4), $parameters[0]);
774774
}
775775

776776
// Finally we will assume that the method is actually the beginning of a

0 commit comments

Comments
 (0)