Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0

Fluent is out dated. Its Eloquent now and Eloquent 2 if fully featured.

Last updated 2 years ago.
0

OK, thanks. What about question number 1?

Last updated 2 years ago.
0

@OKNoah, gayanhewa seems a bit confused. It's simply referred to as the Query Builder now. Eloquent is the ActiveRecord ORM layer which builds on top of Query Builder.

You'd typically prefer the query builder to raw sql in situations where having an OO, or simply conditional approach to building a query is preferred (or often, just for the preference and extra features like simple caching, automatic escaping and prepared statements, etc.) See here for more details - http://laravel.com/docs/queries

For instance, if you want to conditionally add where clauses, sorting, limiting, etc based on arguments passed into a function, the query builder will lend itself much nicer to good organization than smashing strings together with raw SQL.

That being said, highly complex queries tend to be easier to write in raw SQL.

In general you can stick with the query builder, but don't feel bad about dropping to a raw query if you think it'll increase readability, speed, or just development speed to crank it out.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

OKNoah oknoah Joined 7 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.