lee-to/moonshine-algolia-search
最新稳定版本:1.0.0
Composer 安装命令:
composer require lee-to/moonshine-algolia-search
包简介
Algolia global search for MoonShine
关键字:
README 文档
README
Algolias search for MoonShine
As a result, all menu items will be indexed, including groups, resources, resource entries and custom pages
Installation
composer require lee-to/moonshine-algolia-search
Publish config
php artisan vendor:publish --provider="Leeto\MoonShineAlgoliaSearch\Providers\MoonShineAlgoliaSearchServiceProvider"
Register on the https://www.algolia.com, get the keys and set in config config/algolia.php
return [ 'app_id' => env('ALGOLIA_APP_ID'), 'admin_key' => env('ALGOLIA_ADMIN_KEY'), 'frontend_key' => env('ALGOLIA_FRONTEND_KEY'), ];
MoonShine config (app/moonshine.php)
// ... 'header' => 'algolia-search::global-search' // ...
Create indexes
php artisan algolia-search:indexes
If you want to customize fields for models, implement the HasGlobalAlgoliaSearch interface
use Illuminate\Database\Eloquent\Model; use Leeto\MoonShineAlgoliaSearch\Contracts\HasGlobalAlgoliaSearch; class Post extends Model implements HasGlobalAlgoliaSearch { public function globalSearch(): array { return [ 'description' => $this->text, 'image' => $this->thumbnail ]; } }
统计信息
- 总下载量: 2.27k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-01