Replies: 2 comments 6 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
-
You could do something like this:
In your City model add: public function getLabelAttribute()
{
return $this->name . ' - ' . $this->country->name;
} |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Need some help
I have 3 tables countries and cities and places
Country hasMany cities
City belongsTo country
Place belongsTo city
Now, I want to make a relation field (backend) that show City name AND Country name.
I tried concat(name, ' - ', country) but no way for success
I tried some SQL syntax, but failed
My city-country field is:
What supposed to do to properly show city - country?
Beta Was this translation helpful? Give feedback.
All reactions