another,... here we go,... The special _find[Type] methods receive three arguments as shown above. The first one means the state of the query execution, which could be either before or after. It is done this way because this function is just a sort of callback function that has the ability to modify the query before it is done, or to modify the results after they are fetched.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste sunt cupiditate asperiores atque consectetur reiciendis, ex voluptate! Atque distinctio, illum minus consectetur quae explicabo eveniet dolorum voluptatum excepturi autem illo, laudantium iusto itaque vero.
Typically the first thing to check in our custom find function is the state of the query. The before state is the moment to modify the query, bind new associations, apply more behaviors, and interpret any special key that is passed in the second argument of find. This state requires you to return the $query argument (modified or not).
The after state is the perfect place to inspect the results, inject new data, process it in order to return it in another format, or do whatever you like to the recently fetched data. This state requires you to return the $results array (modified or not).
You can create as many custom finders as you like, and they are a great way of reusing code in your application across models.
Typically the first thing to check in our custom find function is the state of the query. The before state is the moment to modify the query, bind new associations, apply more behaviors, and interpret any special key that is passed in the second argument of find. This state requires you to return the $query argument (modified or not).
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste sunt cupiditate asperiores atque consectetur reiciendis, ex voluptate! Atque distinctio, illum minus consectetur quae explicabo eveniet dolorum voluptatum excepturi autem illo, laudantium iusto itaque vero.