mikebronner / laravel-model-caching

Eloquent model-caching made easy.
MIT License
2.24k stars 213 forks source link

have bug in fillable change diynamci #352

Open vahidalvandi opened 4 years ago

vahidalvandi commented 4 years ago

Describe the bug i need chnage fillable in eloquent by user role

    public function __construct(array $attributes = []) {

        if(auth()->user()->is_admin){
            $this->fillable[] = 'is_active';
            $this->fillable[] = 'sales_discount';
            $this->fillable[] = 'business_package_id';
            $this->fillable[] = 'business_contract_id';
        }

        parent::__construct($attributes);

    }

but need twice update for get fillable
Environment

Additional context Add any other context about the problem here.

mikebronner commented 4 years ago

Hi @vahidalvandi, Thanks for reporting this. My hunch says this issue is not related to the package. I will try to recreate this in a test case. If you are able to recreate this in a unit test, please submit a PR for it, that would help a lot.

vahidalvandi commented 4 years ago

Thank you . This bug related with this package because after remove cache trait fix it

On Tue, 19 May 2020, 18:57 Mike Bronner, notifications@github.com wrote:

Hi @vahidalvandi https://github.com/vahidalvandi, Thanks for reporting this. My hunch says this issue is not related to the package. I will try to recreate this in a test case. If you are able to recreate this in a unit test, please submit a PR for it, that would help a lot.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GeneaLabs/laravel-model-caching/issues/352#issuecomment-630855820, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4BZB3C3IWQNUGTH67JIHLRSKJN5ANCNFSM4ND4ZQKA .

vahidalvandi commented 4 years ago

do it fixed?

mikebronner commented 4 years ago

@vahidalvandi Can you provide the eloquent query you are having problems with as well?