0

Here is the controller :

public function getSearch()
{   
    $search = e(Input::get('name'));
    $search = preg_replace('#[^a-z A-Z 0-9 ? !]#i',' ', $search);
    $query = "MATCH (name,description) AGAINST ('".$search."' IN BOOLEAN MODE)";
    $accounts = Account::whereRaw($query)->paginate(10);
    if ($accounts->count())
    {
        return View::make('accounts.all')->with('accounts',$accounts);
    }
    else
    {
        $accounts = Account::paginate(10);
        Session::flash('fail', 'Sorry, the search term - '.$search.' did not match any records');
        return View::make('accounts.all')->with('accounts',$accounts);
    }
}

So the controller executes the else statement, however there are no any errors.

This is the row query:

SELECT * FROM `accounts`  WHERE MATCH(name,description) AGAINST('search word' IN BOOLEAN MODE)
Michael0x2a
  • 58,192
  • 30
  • 175
  • 224
Mikail G.
  • 454
  • 5
  • 19
  • show you dump of $accounts. `dd($accounts)`; –  Jul 13 '15 at 14:51
  • Hi , its solved I was trying to search using half of a word but I didn't know it needs to be the full word in order to be found, thanks – Mikail G. Jul 13 '15 at 15:00

1 Answers1

0

its solved I was trying to search using half of a word but I didn't know it needs to be the full word in order to be found, thanks

Mikail G.
  • 454
  • 5
  • 19
  • even though you solved this you could just as well use something like [this](http://stackoverflow.com/questions/13386774/using-eloquent-orm-in-laravel-to-perform-search-of-database-using-like) – Cayce K Jul 13 '15 at 15:23