How to add Sortable trait to Backend\Models\User ?
Take a look at this post:
Thx. Unfortunately it’s still unclear for me.
I can do like this, right?
class CustomBackendUser extends \Backend\Models\User{
use Sortable;
}
But how to swap Backend\Models\User model with my own?
Hey @boarworm
Most people I’ve seen use the system.extendConfigFile
event to override the configuration to swap out the model class found in generated configuration files.
Here is an example of changing a property:
Event::listen('system.extendConfigFile', function ((string) $path, (array) $config) {
if ($path === '/plugins/author/plugin-name/controllers/mycontroller/config_relation.yaml') {
unset($config['property_value']['view']['recordUrl']);
return $config;
}
});