'Get Collection from complicated query

For example, I need to get city name in search field. City, as Model, has its own name and region string columns. I need to get Collection in order like:

  1. Cities with name ilike input value
  2. Cities with region ilike input value
  3. Other cities.


Solution 1:[1]

City::where(['name'=>'ilike','region'=>'ilike'])->get() - It it is equivalent to - Select * from cities where region = 'ilike' and name = 'ilike'
or maybe you mean this 
1.City::where('name','ilike')->get() ;
2.City::where('region','ilike')->get();
3.City::where('region',"!=",'ilike')->where('name',"!=",'ilike')->get();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Liudmila Savateeva