MickBee's avatar

Should I be using models in Lumen?

Hi,

Does the fact that with->Eloquent() is commented out suggest that I shouldn't be using models in my API?

Thanks,

Mick

0 likes
3 replies
s4muel's avatar

well, lumen is the "speedy brother". it has just been disabled to make it a bit more more swift. but if you need it, just enable it and use it as you like;)

topvillas's avatar

I don't think it really matters. Unless you're writing raw SQL, you're using the QueryBuilder. When push comes to shove, Eloquent models are just a convenient way to deal with your entities.

Don't quote me but speed wise, I don't think you'll experience a meaningful difference.

tykus's avatar

It really depends on what you are retrieving; there is a cost to pay for instantiating Model objects. If there are a lot of records, then that cost might become more apparent. For simple CRUD operations, then models can give you a lot more convenience.

Please or to participate in this conversation.