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 IlluminateDatabaseEloquentModel::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?
2
Answers
You can use Eloquent this way
Or You can use DB query this way
try this version