This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

dfrost
dfrost

Hi, guys! I faced one problem while developing my plugin. So, my model class has two one to many relationships such as
public $belongsTo = [
'user' => 'Me\MyPlugin\Models\User',
'category' => 'Me\MyPlugin\Models\Category'
];

And such accessing of it in columns will not help it to recognize a model from wich to take values, as i think. valueFrom doesn't help category:
type: relation
select: name
user:
type: relation
select: login

Last updated

dfrost
dfrost

My solution is to use getUserLoginAttributes() and getCategoryNameAttributes() where i return something like
return $this->user->login;
return $this->category->name
but maybe it will look great, when the possibility for handling such conflicts will be provided. Thank you

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.