Sometimes, you need to make an Eloquent query that is modified by adding different parts based on other criteria. A typical good example of this is when you submit an advanved search form elements, Then you will need to create a query and then add the criteria based on the different inputs from the form.
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.