PHP code example of wang-tech-commits / laravel-searchable

1. Go to this page and download the library: Download wang-tech-commits/laravel-searchable 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/ */

    

wang-tech-commits / laravel-searchable example snippets


use MrwangTc\Searchable\Searchable;

class Article extends Model
{
    use Searchable;
    
    public static function boot() {
        parent::boot();
        
        static::saved(function($model) {
            // 文章关键字,可选参数;
            $keywords = ''; 
            $model->searchForModel($keywords);
        });
    }
    
    <...>
}
bash
$ php artisan migrate