astroanu said:
see method and property overloading http://php.net/manual/en/language.oop5.overloading.php
I know laravel is doing something like $user->tasks = $user->tasks()->get();
somewhere. My question is Where.
vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3376
/**
* Dynamically retrieve attributes on the model.
*
* @param string $key
* @return mixed
*/
public function __get($key)
{
return $this->getAttribute($key);
}
/**
* Dynamically set attributes on the model.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function __set($key, $value)
{
$this->setAttribute($key, $value);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community