-
Notifications
You must be signed in to change notification settings - Fork 220
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
Getting error while update item #202
Comments
Thanks for posting this. Can you provide the full stack trace of the error? That will help me identify what is going on. |
remove the class
|
Thanks @mycarrysun :). This will take some thinking. I see that the global scope method is passing in the closure. Grrr. |
@mikebronner if he wants to keep the class, he can just use: // App\Models\App\Item.php
protected static function boot()
{
parent::boot();
# Order by order DESC
static::created(function() {
Artisan::call('cache:clear');
});
static::updated(function() {
Artisan::call('cache:clear');
});
static::deleted(function() {
Artisan::call('cache:clear');
});
static::addGlobalScope('order', function (Illuminate\Database\Eloquent\Builder $builder) {
$builder->orderBy('order', 'asc');
});
} The error will go away. This is not a bug with the library. |
Thanks guys |
@mycarrysun I will research your solution to see if it solves the global scope problems #106 Thanks for your help troubleshooting :) |
Describe the bug
I am getting error as below while update Item object...
[2019-01-17 08:34:58] dev.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Argument 1 passed to App\Models\App\Item::App\Models\App{closure}() must be an instance of App\Models\App\Builder, instance of GeneaLabs\LaravelModelCaching\CachedBuilder given, called in /home/anilg/data1/html//vendor/illuminate/database/Eloquent/Builder.php on line 921 in /home/anilg/data1/html//app/Models/App/Item.php:139
Stack trace:
#0 /home/anilg/data1/html/****/vendor/illuminate/database/Eloquent/Builder.php(921): App\Models\App\Item::App\Models\App{closure}(Object(GeneaLabs\LaravelModelCaching\CachedBuilder))
Item Model has below additional code :
protected static function boot()
{
parent::boot();
Environment
Additional context
If I clear cache by command "php artisan cache clear" then It's working well for only first time.
The text was updated successfully, but these errors were encountered: