This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
miguel35454
Hello, I would like some guidelines for the best approach to extend the rainblab user plugin with the nullable trait in the model. I've tried to make a behavior but it doesn't do the trick:
<?php namespace MyPlugin\Member\Behaviors;
use October\Rain\Database\Traits\Nullable as NullableTrait;
class Nullable extends \October\Rain\Database\ModelBehavior
{
use NullableTrait;
protected $nullable = [];
public function __call($name, $params = null)
{
if (!method_exists($this, $name) || !is_callable($this, $name)) {
return call_user_func_array([$this->model, $name], $params);
}
}
}
and then, in the boot method of my Plugin:
public function boot()
{
UserModel::extend(function($model) {
$model->implement[] = 'MyPlugin.Member.Behaviors.Nullable';
$model->addDynamicProperty('nullable', ['lpm_gender']);
});
}
1-1 of 1