gearbox-solutions / eloquent-filemaker

A Model extension and Eloquent driver for Laravel connecting to FileMaker through the Data API
https://gearboxgo.com
MIT License
56 stars 16 forks source link

Add ability to limit portal results when using the Eloquent query builder #74

Closed tkuijer closed 1 month ago

tkuijer commented 3 months ago

This PR adds the ability to increase the amount of returned portal records when using the Eloquent builder. This allows the user to have more then the default of 50 records returned when using the FMModel.

For example; we have a layout 'Users' with a portal 'LogEntries' containing 100 lines. With the current version it is not possible to retrieve all log entries when having the User as an FMModel instance, since this always returns the default limit of 50 related records.

When this PR gets merged, we can instead chain the limitPortal method when retrieving a user and get all the logentries like this:

$user = User::query()->limitPortal('LogEntries', 200)->first();
likeadeckofcards commented 1 month ago

Hello @tkuijer Thank you for this PR. This functionality should work without adding the method to the FMEloquentBuilder class. Laravel's EloquentBuilder class, which we are extending, already has logic to forward all method calls for which the method does not exist in the EloquentBuilder class to the base QueryBuilder class.