Search comma separated value using find_in_set() in Laravel 5 Example

July 9, 2017 | Category : Laravel PHP

Here is a crazy example today, how to use find_in_set() mysql function in laravel query builder. If you need to add tags or something that store as comma separated values in database column, then you can simply store but if also need to search then it can be hard.

Like if you have posts table with tags column you simply store data like "laravel,php,html" etc comma separated string then how you found records only tags belong to laravel. So at that moment we can use mysql find_in_set() and we can use this function using whereRaw() of laravel query builder. So let's bellow bellow syntax and example.




$data = \DB::table("posts")




I hope you found your best.....