PHP code example of opensearch / laravel-opensearch
1. Go to this page and download the library: Download opensearch/laravel-opensearch 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/ */
opensearch / laravel-opensearch example snippets
use App\Models\ShopSearchModel;
Route::get('search', function () {
// 为查看方便都转成数组
dump(ShopSearchModel::search('搜索关键字')->get()->toArray());
});
bash
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
php artisan scout:flush "App\Models\ShopSearchModel"