How to search with comma seperated value from database in laravel
Laravel is a most common framework. it is very easy to use and learn. when we get data from database we require to manage to take single database column for multiple integer ids.when we store comma seperated ids in database but how can we search specific id data from comma separated column value in laravel.for this we can use “find_in_set()” predefined function.
1. $searchData = 1;
$data = \DB::table(“TABLENAME”)
2. $result = YOURTABLENAME::where(“YOUROTHERCONDITION”)->whereRaw(“find_in_set(‘”.$searchData .”‘,DB_COLUMN_NAME)”)->get();
For More Infomation CLICK HERE