sql - Undefined Column | Laravel Eloquent Reverse Like -


i want rows have column part of string (not inverse)

i did query,

select * table 'string' concat('%', column, '%') 

the query works correctly when running directly on server via sql querying tool.

however, i'm using eloquent orm, tried following :

$results = model::where('my_string','like',"concat('%',column, '%')")->get(); 

it throws error :

sqlstate[42703]: undefined column: 7 error: column "my_string" not exist 

line 1:

please note i'm not looking :

select * table column '%string%' 

from comment above. if got working sql statement. can use raw expressions

model::whereraw("'string' concat('%', column, '%')"); 

for more information, http://laravel.com/docs/5.0/queries in raw expressions section


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -