Some times you will need to create an eloquent where clause and inside that where you may need to add extra or where claused
Here is a sample of a complicated query that includes where and with and inner queries. This snuppet is the one used to get the legislative event stream on the dashboard in the GovIQ project.
In laravel and eloquent, some times you might need to run a normal SQL select statement. So here is an example to do so:
Sometimes you will need to order the eloquent results based on a relationship for example posts and categgories. Here are different ways to do so based on this laravel daily video : https://www.youtube.com/watch?v=lRi1-RYnQ7A
Some time, you may need to get a record with some relationship and at the same time you need to get an inner relationship to that relationship and so forth. Here is the key : $records->with(['bill', 'bill.sponsor', 'bill.sponsorSenator', 'bill.sponsor.actions']).
Sometimes, You will need to order by a varchar column as an integer. for example if you have the billNumbers in two rows as 5 and 1400 the order as varchar in desc order will get that with 5 first then that with 1400. While the opposite is what is wanted in the ordering using integers.