#Why is Model::increment() protected?

4 messages · Page 1 of 1 (latest)

random forge
#

Illuminate\Database\Eloquent\Model’s increment() method is protected. When I call ->increment() on a model my IDE will warn me that it is a protected method, but the call does in fact increment the value in the given column.

Is this an oversight? Should this method simply be public? Why does it work despite it being protected?

soft wadi
#

Technically your call is being proxied to the underlying query builder and not actually using the increment method on the model

random forge
#

Cool, so that means my IDE is just confused, but the increment method on the query builder is totally valid?

soft wadi
#

Yeah