Support the ongoing development of Laravel.io →
Database Eloquent Architecture
Last updated 2 years ago.
0

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.

0
Solution

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);
    }
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lcjury lcjury Joined 1 Dec 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.