I was missing this feature and stumbled upon this issue: #77
After reading the issue and the comments I decided to create this feature request and introduce a potential way of implementing this.
This would be nice feature to have.
I've created a trait in my project based off of @litvinjuan's answer in the issue:
<?php
namespace App\Concerns;
trait ExtendParentFillables
{
public function getFillable()
{
$parentFillable = (new \ReflectionClass($this))->getParentClass()->newInstance()->getFillable();
return array_merge($this->fillable, $parentFillable);
}
}
This could be included in the package and to prevent breaking changes this could be added in the form of a trait as well. Which would make it opt-in and opens the potential for a "guarded" form as well.
The trait is not only useful in parental's context as it can be used to extend any models' fillables.
I was missing this feature and stumbled upon this issue: #77
After reading the issue and the comments I decided to create this feature request and introduce a potential way of implementing this.
This would be nice feature to have.
I've created a trait in my project based off of @litvinjuan's answer in the issue:
This could be included in the package and to prevent breaking changes this could be added in the form of a trait as well. Which would make it opt-in and opens the potential for a "guarded" form as well.
The trait is not only useful in parental's context as it can be used to extend any models' fillables.