Dec 16, 2018
3
Level 1
Indirect modification of overloaded property ... has no effect
Howdy!
I'm having trouble with some appended attributes on a model. I get the following error:
Indirect modification of overloaded property App\ModelName::$aspects has no effect
The model itself has the appended attributes, like so:
<?php
class ModelName extends Model {
protected $appends = ["aspects"];
public function getAspectsAttribute() {
// returns an array, or null
}
}
The error is thrown in a template, where I'm simply looping through the attributes:
@if($problem->aspects)
@foreach( $problem->aspects as $aspect )
{{ $aspect->description }}@if ($aspect != end($problem->aspects)),@else.@endif
@endforeach
@endif
Any ideas on why this is throwing an error? Strangely, this template is an email, and I only see the error when I try and send it. When I view the template in a browser, it's fine.
Please or to participate in this conversation.