Search code examples
phplaraveltinker

Laravel mass update enum column to different value through Tinker


I'm trying to do a mass-update of an enum column's value in my Laravel 9 project through tinker, my model is called Domain and I have an enum column called status with different values.

I'd like to select all entries where status is expired and set them to a different value.

I've tried running this in Tinker but it throws an error:

PHP Deprecated: Non-static method Illuminate\Database\Eloquent\Model::update() should not be called statically in /Users/ryanholton/Sites/fudge-apieval()'d code on line 1

Domain::where('status', 'expired')->update(['status' => 'pending']);

What am I missing?


Solution

  • try this version

    
    Domain::query()->where('status', 'expired')->update(['status' => 'pending']);