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

Error dispatcher fire on creation of model #46

Closed
sascha-schieferdecker opened this issue Mar 4, 2019 · 2 comments
Closed

Error dispatcher fire on creation of model #46

sascha-schieferdecker opened this issue Mar 4, 2019 · 2 comments

Comments

@sascha-schieferdecker
Copy link

Using Laravel 5.8.2, new to Laravel. Unsure if it's a bug or I am using it incorrectly. Glad for any help.

When creating a new model in the controller:

$category = app('rinvex.categories.category')->fill(['name' => $request->name, 'description' => $request->description]);
$category->save();

an exception is thrown:

Call to undefined method Illuminate\Events\Dispatcher::fire()

vendor/rinvex/laravel-cacheable/src/CacheableEloquent.php

From line 212:

           return true;
        }
 
        // We will append the names of the class to the event to distinguish it from
        // other model events that are fired, allowing us to listen on each model
        // event set individually instead of catching event for all the models.
        $event = "eloquent.{$event}: ".static::class;
 
        $method = $halt ? 'until' : 'fire';
 
        return static::$dispatcher->{$method}($event, static::class);
    }
 
    /**
     * Reset cached model to its defaults.
     *
     * @return $this
     */
    public function resetCacheConfig()
    {
        ! $this->cacheDriver || $this->cacheDriver = null;
        ! $this->cacheLifetime || $this->cacheLifetime = -1;
 
        return $this;
    }

@dom235
Copy link

dom235 commented Mar 4, 2019

Stay calm, it's a bug and if we pay a little more patience it's getting fixed soon i think. I need this fix too

The "fire" method has been deprecated

laravel/framework#26392

@Omranic
Copy link
Member

Omranic commented Mar 6, 2019

Fixed and stable release has been tagged already, enjoy 😉 https://github.com/rinvex/laravel-cacheable/releases/tag/v2.0.1

@Omranic Omranic closed this as completed Mar 6, 2019
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

3 participants