exdeliver/elastic 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

exdeliver/elastic

Composer 安装命令:

composer require exdeliver/elastic

包简介

:package_description

README 文档

README

Elasticsearch for Laravel Resources

Installation

Via Composer

$ composer require exdeliver/elastic

Usage

Create a resource and define the data to be imported by resources.

php artisan make:resource PhoneNumberResource


<?php

namespace App\Http\Resources;

use App\Models\PhoneNumber;
use Exdeliver\Elastic\Resources\ElasticSearchResource;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;

class PhoneNumberResource extends ElasticSearchResource
{
    public const ELASTIC_INDEX = 'phone_numbers';

    public static function model(): Model
    {
        return new PhoneNumber();
    }

    public function toElastic(Request $request): array
    {
        /**
         * Data from the model that should be imported
         */
        return [
            'index' => self::ELASTIC_INDEX,
            'body' => [
                'uuid' => $this->uuid,
                'number' => $this->phonenumber,
                'contact' => ContactResource::make($this->contact), // supports make() and collection()
            ],
        ];
    }

    public static function elastic(): array
    {
        return [
            'index' => self::ELASTIC_INDEX,
        ];
    }
}

Your controllewr

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author@email.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.

elastic

统计信息

  • 总下载量: 1.58k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固