Even more fluent eloquent model via magic setters

Now it is possible to use Eloquent's magic setters in chains. For example:

    $model->set_foo('foo')->take(10)->set_bar(some_function());
    // ...even though setters 'foo' and 'bar' are not defined on the model
This commit is contained in:
Pavel Puchkin
2013-05-08 18:19:27 +11:00
parent cffded660c
commit 3a46721eca
2 changed files with 15 additions and 1 deletions

View File

@@ -770,6 +770,7 @@ abstract class Model {
elseif (starts_with($method, 'set_'))
{
$this->set_attribute(substr($method, 4), $parameters[0]);
return $this;
}
// Finally we will assume that the method is actually the beginning of a