Skip to content

Referring related table? belongs_to field? #305

Closed Answered by ericleversen
ericleversen asked this question in Help
Discussion options

You must be logged in to vote

I received an answer on the Statamic Discord which solved the issue:

Make an attribute 

function getUserEmailAttribute() {
    return $this->user?->email;
} 


Append it in your model

public $appends = ['user_email'];


Then use that in your yaml.
        handle: user_email

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@ericleversen
Comment options

@duncanmcclean
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ericleversen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
2 participants