Last Update : 2023-09-22 UTC 07:29:47 AM
w3coded full fulltext Stack Overflow for Teams w3coded full fulltext Where developers & technologists w3coded full fulltext share private knowledge with coworkers w3coded full fulltext ,Please be w3coded full fulltext sure to answer the question. Provide details and w3coded full fulltext share your research!,But How can I use Laravel w3coded full fulltext query builder to add fulltext index?,On Laravel w3coded full fulltext >= 6.15.0 you can extend w3coded full fulltext Illuminate\Database\Schema\Grammars\MySqlGrammar w3coded full fulltext and Illuminate\Database\Schema\Blueprint classes w3coded full fulltext like this (e.g. on boot() method of your w3coded full fulltext AppServiceProvider):
On Laravel >= 6.15.0 you can extend Illuminate\Database\Schema\Grammars\MySqlGrammar
and Illuminate\Database\Schema\Blueprint
classes like this (e.g. on boot()
method of your AppServiceProvider
):
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Grammars\MySqlGrammar;
use Illuminate\Support\Fluent;
Blueprint::macro('fulltext', function ($columns, $name = null, $algorithm = null)
{
return $this->indexCommand('fulltext', $columns, $name, $algorithm);
});
Blueprint::macro('dropFulltext', function ($index)
{
return $this->dropIndexCommand('dropIndex', 'fulltext', $index);
});
MySqlGrammar::macro('compileFulltext', function (Blueprint $blueprint, Fluent $command)
{
return $this->compileKey($blueprint, $command, 'fulltext');
});
And use it on your migrations like this:
Schema::table('flights', function (Blueprint $table) {
$table->fulltext(['name', 'airline']);
});
//reverse the migration
Schema::table('flights', function (Blueprint $table) {
$table->dropFulltext(['name', 'airline']);
});
For multiple Columns/Fields
DB::statement('ALTER TABLE Database.TableName ADD FULLTEXT fulltext_index (Col_1, col_2, col_3)');
Last Update : 2023-09-22 UTC 11:55:35 AM
Last Update : 2023-09-22 UTC 11:55:21 AM
Last Update : 2023-09-22 UTC 11:55:01 AM
Last Update : 2023-09-22 UTC 11:54:55 AM
Last Update : 2023-09-22 UTC 11:54:38 AM
Last Update : 2023-09-22 UTC 11:53:58 AM
Last Update : 2023-09-22 UTC 11:53:46 AM