Skip to content

Instantly share code, notes, and snippets.

@clouddueling
Created February 1, 2013 03:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save clouddueling/4689004 to your computer and use it in GitHub Desktop.
Save clouddueling/4689004 to your computer and use it in GitHub Desktop.
A better fulltext search for laravel returning eloquent objects
public static function search_contacts($terms)
{
$terms = mysql_real_escape_string($terms);
$contact_results = Contact::where_account_user_id(Auth::user()->account_user_id)
->raw_where("match (`first`, `last`) against ('{$terms}*' IN BOOLEAN MODE)")
->where_deleted(0)
->paginate(20);
phpconsole($contact_results->results);
return $contact_results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment