0

i have a problem in my search form. In my database all data is in upper case , so when i input lower case letter in search field it do not gives any result. So i trying to find out how to make my form insensitive.

This is the model:

// chassis
    public function chassis($chassis)
    {
        return $this->builder->where('model_type_en', 'LIKE', "%$chassis%");
    }

Do you have any ideas how i can use upper(model_type_en) in this function?

Dmitry Malys
  • 1,293
  • 4
  • 25
  • 46
  • Possible duplicate of [How can I search (case-insensitive) in a column using LIKE wildcard?](http://stackoverflow.com/questions/2876789/how-can-i-search-case-insensitive-in-a-column-using-like-wildcard) – M. Eriksson May 14 '17 at 05:44

1 Answers1

0
// chassis
    public function chassis($chassis)
    {
        $str = strtoupper($chassis);
        return $this->builder->where('model_type_en', 'LIKE', "%$str%");
    }
Amir
  • 4,089
  • 4
  • 16
  • 28