Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Merge fillable columns with parent #118

Closed
sneakylenny opened this issue Sep 7, 2023 · 1 comment
Closed

[Feature request] Merge fillable columns with parent #118

sneakylenny opened this issue Sep 7, 2023 · 1 comment

Comments

@sneakylenny
Copy link

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.

@driftingly
Copy link
Member

Resolved by #120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants