I currently working on a laravel 5.4 project where I'm trying to find values in my database that are similar to a search string introduced. For example, I have the following search term
$search_term = "Some long phrase with words"
and in my database (MySQL) I have a table tags with a column value. One row in this table would have value => 'some', another row might have value => 'long', and another row might have value => 'phra'
What I need is to create a collection of all tags where the value appears in my search term. Which means the 3 rows i mentioned should match for my $search_term
I currently know that I can use eloquent in laravel and say something like
Tag::where('value', 'like', "%".$search_term."%")->get()
But as far as I understand this would see if the $search_term is a sub-string of what's in the value column.
How can I use eloquent to ask if value is contained (a sub-string) in $search_term?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)