Comments (5)
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
from october.
Hey @sqwk
To confirm, is this configuration used in Tailor or a plugin?
from october.
This is a plugin. I haven't tried it with Tailor.
from october.
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
from october.
I don't believe I can add an accessor to a model that I don't control (\Backend\Models\User
in this particular case).
from october.
Related Issues (20)
- Wrong Order for displayMode: sidebar on Small Screens HOT 1
- Group Scope for Parent/Nested Relations HOT 1
- Class 'Str' not found HOT 2
- Call to undefined method October\Rain\Database\Relations\AttachMany::getRelatedKeyName() HOT 1
- Error exporting models using csv_custom file format HOT 4
- Installing October from scratch HOT 4
- Call to undefined method Backend\Widgets\Lists::setFormValues HOT 2
- How i can get EntryRecord october://<TYPE>@link/<REFERENCE>?<PARAM>=<VALUE> HOT 3
- After updation from v3.5 to v3.6, Plugin loads to soon failing to load translation file and to add a main menu item using BackendMenu::registerCallback HOT 10
- How to implement manage attaching and detaching nested relationships in OctoberCMS?
- "Method October\Rain\Database\Collection::hasRelation does not exist." on line 113 of HOT 3
- Video from media not showing HOT 1
- plugin:test command ignores phpunit.xml environment variables HOT 3
- The system.manage_logs role for "Log Settings" is not enabled
- Critical fail when updating with php artisan october:update HOT 2
- Using drafts doesn't work as expected on blueprints using groups HOT 1
- Command "october:install" is not defined HOT 1
- Tailor Permissions get grouped by name and not by parent navigation HOT 3
- Error when accessing email templates "admin/system/mailtemplates" from backend
- Override data-request-confirm HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from october.