PHP code example of nin / mysql-ft-search

1. Go to this page and download the library: Download nin/mysql-ft-search library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nin / mysql-ft-search example snippets


Nin\MySqlFtSearc\ServiceProvider::class,


use Illuminate\Database\Migrations\Migration;
use Nin\MySqlFtSearch\Facade as FtSchema;

class CreatePostsTable extends Migration
{
    public function up()
    {
        FtSchema::create('posts', function (Blueprint $table) {
            $table->id();
            $table->string('title');
        
            $table->fulltext(['title']);
        });
    }
}



use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;

class Post extends Model
{
    use Searchable;

    /**
     * The columns of the full text index
     */
    public $searchable = [
        'title',
    ];
}


use App\Models\Post;

$rs = Post::search('Foo')->get();
bash
$ php artisan vendor:publish --provider="Nin\MySqlFtSearc\ServiceProvider"