Can't perform Ilke searches

Good afternoon.

I’m using PostgreSQL with GCE. The column headers where searches are performed aren’t ILIKE. How can I fix this?

Thanks

Hello @NOLO ,

You can do that by creating a custom Model which you can extend splitFilterValue. The custom model will look like this:

<?php

use GroceryCrud\Core\Model;

class PostgresCustomModel extends Model
{
    public function splitFilterValue($filterValue) {
        $result = parent::splitFilterValue($filterValue);

        $driverName = strtolower($this->getDriverName());

        if ($driverName === 'Postgresql' && $result['comparison'] === 'LIKE') {
            $result['comparison'] = 'ILIKE';
        }

        return $result;
    }
}

You can see how to set your own Model from here: setModel | Grocery CRUD - A PHP CRUD Generator Library

You can find more about splitFilterValue at file: vendor/grocery-crud/enterprise/src/GroceryCrud/Core/Model.php at around line 398

Let me know if that worked for you.

Regards
Johnny