eloquence icon indicating copy to clipboard operation
eloquence copied to clipboard

v11 dynamic relation property not working

Open JustinElst opened this issue 2 years ago • 0 comments

Hi, Thanks for all your great work.

I have upgraded eloquence to V11 but now I get the following message:

The attribute [relation_name] either does not exist or was not retrieved for model

I am trying to access the relation like so: $model->relationName->attributeValueOfRelation In the model I have this relationship definition:

class Model extends LaravelModel
{
    use HasCamelCasing;

    public function relationName(): BelongsTo
    {
        return $this->belongsTo(RelationModel::class);
    }
}

If I revert this commit, everything works as expected: https://github.com/kirkbushell/eloquence/commit/15b885252a1628cbc4ba0f31015329143ab42018

What am I overlooking, the documentation/changelog doesn't mention anything about relationships or its definition...

JustinElst avatar Mar 11 '24 15:03 JustinElst