1 year ago

Why do people use DB instead of Model?

Posted 1 year ago by cmdobueno

So I have been looking around laracasts as well as several other help sites. Why do people use DB so such instead of have a model?

I am asking because I feel like I am missing something (but have a feeling that more likely, they are missing the proper understanding of laravel and eloquent.)

I see DB being used to insert, update, and query, then tons of useless joins... why would one not just use a model and relations to do things properly? Even further it seems to so many people in their response/suggestions also use DB instead of explaining that instead of all these intensive joins, why not just use the power of releations?

So am I missing something about this or is it just people not using the framework properly? Obviously I understand there are times to us DB instead of model but under normal (and nearly 99.99% of the time) usage a model vs db seems to be the correct answer.

Any input would be awesome.

Please sign in or create an account to participate in this conversation.