Cutsom attribute on model available without being in $appends array

Posted 2 years ago by longestdrive

Hi

On my development machine I can access a custom attribute without it being in within the $appends array but on my deployed server the method fails - it returns null because the attribute doesn't exist

Is there a php or config setting that enables the attribute to be accessed with or without it being within $appends

Here's the attribute (which actually comes from a package):

/**
     * Returns the latest message from a thread.
     *
     * @return \Cmgmyr\Messenger\Models\Message
     */
    public function getLatestMessageAttribute()
    {
        return $this->messages()->latest()->first();
    }

My development machine is within homestead which uses php 7, the deployed server uses php 5.6 - does that make a difference?

Just curious so I can allow for it or feedback to the package developer.

Please sign in or create an account to participate in this conversation.