mangola's avatar

How can we get type safety & autocompletion with Laravel's ->update() method?

I just watched Nuno Maduro's video on Laravel Strict Models and was really impressed by the improvements it brings to type safety and developer experience.

While experimenting with it, I realized something that feels like a gap: when using $model->update([...]), we’re still passing an untyped associative array. That means no autocompletion, no static analysis, and no compile-time safety — unless we rely heavily on tests, it’s easy to accidentally break things.

So I’m curious: Has anyone figured out a clean, type-safe approach to using ->update() in Laravel? Maybe something involving DTOs, custom update methods, or even macros?

Would love to hear how others are thinking about this.

P.S. I'm a type safety nerd 😅

0 likes
0 replies

Please or to participate in this conversation.