normykinz's avatar

Eloquent model properties

To get things off on the right foot. This is by no means a critique of Laravel or Eloquent. I think Laravel is far and away the best backend framework out there (in any language?).

There's one thing that I'm vexxed by though is the magical world of Eloquent model properties. The lack of IDE autocompletion and type hinting is a big itch for me. I'm wondering then if there's a good means to scratch it.

I have been using https://github.com/lepikhinb/laravel-fluent for a while but, of course, the same old third party package problems arise when a new version of the framework is released. No updates from the maintainers.

I've also tried https://github.com/barryvdh/laravel-ide-helper but for some reason it doesn't seem to work in VSCode and t seems like a bit of an awkward hack to me regardless.

So, would manually writing getPropertyX(): string and setPropertyX(string $value): void method work if I used the model attributes array or would this break some magical Eloquent thing I'm unaware of?

0 likes
0 replies

Please or to participate in this conversation.