Пример #1
0
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     DB::statement('CREATE VIRTUAL TABLE tags_fts USING fts3(tag_id, words);');
     $tags = Tag::get();
     foreach ($tags as $tag) {
         $fts = new TagFts();
         $fts->tag_id = $tag->id;
         $fts->words = FtsUtils::toNgram($tag->name);
         $fts->save();
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     //
     DB::statement('CREATE VIRTUAL TABLE items_fts USING fts3(item_id, words);');
     $items = Item::get();
     foreach ($items as $item) {
         $fts = new ItemFts();
         $fts->item_id = $item->id;
         $fts->words = FtsUtils::toNgram($item->title . "\n\n" . $item->body);
         $fts->save();
     }
 }