gearbox-solutions / eloquent-filemaker

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

Improve compatibility with general eloquent usage and Laravel Nova #66

Closed tkuijer closed 4 months ago

tkuijer commented 4 months ago

This PR automatically corrects the sort order when using the orderBy query builder function. This is needed for compatibility with thelatest and oldest methods, which by default use 'asc' or 'desc' for their order.

This also adds a getCountForPagination method override to return the correct FM count.

Both improve compatibility with Laravel Nova.

Smef commented 4 months ago

Is the pagination functionality used somewhere? In the regular builder it's only used by the paginate functions, but we have our own versions of those. I'm not sure this paginate functionality is going to work correctly as-is anyway.

tkuijer commented 4 months ago

Thanks for the merge! Love the package so far!

I'm not sure about consequences for the regular pagination, however Laravel Nova encountered errors with its pagination. Appears they use some more obscure eloquent features.

Smef commented 4 months ago

Ah. I haven't tried it with Nova. Does this get you the right value in there? It seems like it would need to hit the database to get that, and this isn't doing much at all.