So i'm trying to fix a tool that matches the SQL search and return a match by percentage. I've tried and used this SQL to achieve what I want.
SELECT
(company)
, MATCH(company) AGAINST('SEARCH STRING') as relevance
, b.maxrelevance
, (MATCH(company) AGAINST('DATABASE ENTRY TO BE SEARCHED'))/b.maxrelevance*100 as relevanceperc
FROM
watchlists a
, (SELECT MAX(MATCH(company) AGAINST('DATABASE ENTRY TO BE SEARCHED')) as maxrelevance FROM watchlists LIMIT 1) b
WHERE
MATCH(company) AGAINST('DATABASE ENTRY TO BE SEARCHED')
ORDER BY
relevance DESC;
However, I'm trying to convert the above SQL query to eloquent without any success so far. Any help or guidance are more than welcome!