Skip to content

Error dispatcher fire on creation of model #46

Closed
@sascha-schieferdecker

Description

@sascha-schieferdecker

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;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions