PHP Snippet 1:
DB::statement('ALTER TABLE News ADD FULLTEXT search(title, description)');
PHP Snippet 2:
$table->engine = 'MyISAM'; // means you can't use foreign key constraints
PHP Snippet 3:
$q = Input::get('query');
->whereRaw("MATCH(title,description) AGAINST(? IN BOOLEAN MODE)", array($q))
PHP Snippet 4:
if( getenv('DB_CONNECTION') === 'mysql' ) // or something else
PHP Snippet 5:
$table->fullText('body');
PHP Snippet 6:
User::whereFullText->('body', 'john doe')->get();
PHP Snippet 7:
public function up()
{
Schema::create('news', function (Blueprint $table) {
// ...
$table->string('title');
$table->text('description');
// ...
$table->fullText(['title', 'description'])->language('english');
});
}
PHP Snippet 8:
News::whereFullText->(['title', 'description'], 'YOUR_QUERY_TEXT')->get();