/ Published in: PHP
In this tutorial I will go over implementing Full-Text search in Laravel 4 .
Those who have used Laravel 3 in the past may remember that there used to be support for FULLTEXT indexes. This functionality has been removed in Laravel 4 but can still easily be implemented.
Those who have used Laravel 3 in the past may remember that there used to be support for FULLTEXT indexes. This functionality has been removed in Laravel 4 but can still easily be implemented.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreatePostsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('posts', function(Blueprint $table) { $table->engine = 'MyISAM'; // means you can't use foreign key constraints $table->increments('id'); $table->string('title'); $table->text('body'); $table->timestamps(); }); DB::statement('ALTER TABLE posts ADD FULLTEXT search(title, body)'); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('posts', function($table) { $table->dropIndex('search'); }); Schema::drop('posts'); } }
URL: http://creative-punch.net/implementing-laravel-4-full-text-search/