You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This subject won't be directly treated here. You can either follow the official
documentation.
Configure RulerZ
Once Eloquent is installed and configured we can the RulerZ engine:
$rulerz = newRulerZ(
$compiler, [
new \RulerZ\Eloquent\Target\Eloquent(), // this line is Eloquent-specific// other compilation targets...
]
);
The only Eloquent-related configuration is the Eloquent target being added to the
list of the known compilation targets.
Filter your target
Now that both Eloquent and RulerZ are ready, you can use them to retrieve data.
The Eloquent instance that we previously injected into the RulerZ engine knows
how to use both Illuminate\Database\Query\Builder and Illuminate\Database\Eloquent\Builder
instances, so the first step is to create a query builder:
$queryBuilder = User::query(); // where "User" is an Eloquent model
And as usual, we call RulerZ with our target and our rule.
RulerZ will build the right executor for the given target and use it to filter
the data, or in our case to retrieve data from a database.