Closed sqwk closed 7 months ago
Hey @sqwk
To confirm, is this configuration used in Tailor or a plugin?
This is a plugin. I haven't tried it with Tailor.
The labelling may not need to occur at the SQL level. Try adding an accessor method to your model...
public function getFullNameAttribute(): string
{
return "{$this->first_name} {$this->last_name}";
}
Then use nameFrom: full_name
I don't believe I can add an accessor to a model that I don't control (\Backend\Models\User
in this particular case).
Adding the method via extension might work
\October\Rain\Extension\Container::extendClass(\Backend\Models\User::class, function($model) {
$model->addDynamicMethod('getFullNameAttribute', function() use ($model) {
return "{$model->first_name} {$model->last_name}";
});
});
edit: The method already exists on \Backend\Models\User::class
When using a taglist field in relation mode, one cannot define a select: concat() like for the relation type.
This would be helpful when linking multiple authors/users/owners via a many to many relationship with the built in backend_users. type: relation (checkboxes) works fine, as does the list representation when using the relation manager, but both take up considerably more UI room than a simple taglist.