Is the relationship between this model and your course model a hasOne relationship?
Nov 9, 2018
12
Level 2
Name Attribute Exhausting PHP Memory
I have a model and corresponding database table that I originally created with a database column titled 'name'. However, for consistency reasons, I changed the title of the column. Then, I created a 'name' attribute on the model:
public function getNameAttribute()
{
$formatDate = $this->course->start_date->format('D g:i');
return "<span class='c-enrollment-row__date'>$formatDate</span> <span class='c-enrollment-row__course'>{$this->course->name} Costume Deposit(s)</span>";
}
However, when I use protected $appends = ['name'];, it blows up all my memory and crashes my app. Is there something cached that I need to fix? I ran the following, but no luck:
php artisan cache:clear
php artisan view:clear
php artisan config:clear
TIA
Please or to participate in this conversation.