Skip to content

Instantly share code, notes, and snippets.

@zofe
Last active August 29, 2015 13:57
Show Gist options
  • Save zofe/9394996 to your computer and use it in GitHub Desktop.
Save zofe/9394996 to your computer and use it in GitHub Desktop.
<?php
class Tag extends Eloquent
{
public function scopeSearch($query, $q)
{
$match = "MATCH(`tag`, `varianti`) AGAINST (?)";
return $query->whereRaw($match, array($q))->orderByRaw($match.' DESC', array($q));
}
}
//$tags = Tag::search(Input::get('keywords'))->get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment