I'm developing a package that adds methods dynamically, so I should override the __call method in laravel eloquent model. I write it as a trait, and it's worked but if model using another trait that also overrides __call too, these throw an error with message: "Trait method __call has not been applied, because there are collisions with other trait methods on"
my trait code is something like these:
trait HasX
{
public function __call($name, $arguments)
{
if($name== 'x') return 'x';
return self::__call($name, $arguments);
}
}
It's worked perfectly but if I use another trait that also overrides that these throw that error. For example :
trait HasY
{
public function __call($name, $arguments)
{
if($name== 'y') return 'y';
return self::__call($name, $arguments);
}
}
what is the proper way to achieve this?
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2K2bge1
via IFTTT
Aucun commentaire:
Enregistrer un commentaire