I have some results which I get from the eloquent query, and I want to order them by best match. How can I do it in laravel eloquent?
here I found some solution in SQL, but I could not use it in the eloquent builder.
SELECT TOP 5 *
FROM Products
WHERE ProductCode LIKE '%200%'
ORDER BY CHARINDEX('200', ProductCode, 1), ProductCode
https://bytutorial.com/blogs/tsql/how-to-order-the-sql-query-result-by-best-match-keyword-search