pedroroccon
5 months ago
681
1
Laravel

Searching related tags

Posted 5 months ago by pedroroccon

Greetings

I'm working with 2 models in my application, which is: Question.php and Wiki.php.

The users can create questions, and after creating a question, the application should list some of related wikis to the user, that can probably solve the problem based on title keywords.

The wikis are store with keywords attributes in database. After the user created a new question, how can I search in keywords attributes of my Wiki.php to get the possible related Wikis?

Example:

I have a Wiki with title: "How to fix your print", with tags: "print, fix". The user opens a question with title: "My print isn't working".

How can I search in my Wikis and display to the user: "Hey, this post might help you: How to fix your print"

I could use where, whereIn, orWhere... But I think that isn't work, because this way I'll be searching for a full text instead of keywords.

Someone can help be? Or give me an idea? Thanks!

Please sign in or create an account to participate in this conversation.