Image

Laravel (FIND_IN_SET) Find A Value From Comma Separated Record In A Table.

Finding or checking a value from a comma separated record in a table. 

In users table we have multiple comma seprated value of currency_code like USD,INR,GBP.So will try to find all users who have USD as currency_code.

We will use FIND_IN_SET feature to filter datas.

User::where(['status'=>1])->whereRaw("FIND_IN_SET("USD",currency_code)")->get();

 

Categories: PHP Tags: #Laravel,

Newsletter Subcribe

Receive updates and latest news direct from our team. Simply enter your email.