11.08.2017 Views

codebright

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Eloquent Queries 286<br />

• The model.<br />

• Query Constraints<br />

• Fetch methods.<br />

The model is the model instance that we wish to perform the query upon. All of the examples within<br />

this section will be forming queries based upon the Album model.<br />

Query constraints are rules that are used to match a subset of our table rows. This way we can return<br />

only the rows that we are interested in. The most familiar constraint used with SQL is the WHERE<br />

clause.<br />

Finally, we have the fetch methods. These are the methods that are used to perform the query, and<br />

return the result.<br />

Let’s take a look at the structure of a eloquent query in its simplest form.<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!