laravel-json-api icon indicating copy to clipboard operation
laravel-json-api copied to clipboard

filter slug and underscore

Open niskah-energies opened this issue 3 years ago • 1 comments

Hi,

I'm trying to filter my resource with a slug containing an underscore alpha_2, but it returns an error because slug is modified without underscore alpha2 before to call database. Is there a way to use underscore slugs ??

http://localhost:8000/api/v1/countries?page%5Bnumber%5D=1&page%5Bsize%5D=15&sort=-name&filter%5Balpha_2%5D=fr

error:

Illuminate\Database\QueryException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'alpha2' in 'where clause' (SQL: select count(*) as aggregate from countrieswherealpha2= fr andcountries.deleted_at is null) in file /Users/oujaber/Documents/www/xclusiv.fans-pwa/backend/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 703

Thank you.

niskah-energies avatar Oct 19 '21 10:10 niskah-energies

Please can you share the filter code on the relevant adapter?

lindyhopchris avatar Oct 19 '21 11:10 lindyhopchris