dainsys / ring_central
一个全栈包,用于向Laravel应用程序添加ring_central功能。
v0.2.2
2023-03-01 19:27 UTC
Requires
- dainsys/mailing: ^1.0
- illuminate/support: ^8.0|9.0
- maatwebsite/excel: ^3.1|4.0
Requires (Dev)
- nunomaduro/collision: v5.x-dev
- orchestra/testbench: 6.x-dev
- phpunit/php-code-coverage: 9.2.x-dev
README
扩展ring central报告功能。
安装
- 需要使用composer:
composer require dainsys/ring_central
。 - 在您的.env文件中添加DB连接值
RC_DB_HOST=
RC_DB_DATABASE=
RC_DB_USERNAME=
RC_DB_PASSWORD=
RC_DB_DRIVER=
- 运行迁移:
php artisan migrate
用法
- 请确保您的命令扩展了
\Dainsys\RingCentral\Console\Commands\AbstractProductionReportCommand
。或者,您也可以使用rc:make-command
命令来创建报告。 - 您的签名属性必须提供
dates
所需的属性,这是运行报告所必需的。如果没有提供,将假定今天是日期。 - 此包在底层使用
dainsys/mailing
包更多信息。或者,请确保提供recipients
方法的实现。- 使用
dainsys/mailing
包- 访问您的应用中的URL
/mailing/admin/mailables
,创建一个带有命令类名的mailable记录。例如,当前示例为App\Console\Commands\PublishingProductionReport
。 - 访问URL
/mailing/admin/recipients
来创建新的接收者,并将它们与创建的mailable报告关联起来。
- 访问您的应用中的URL
- 在您的报告命令中提供自己的实现
protected function recipients(): array { return []; }
- 使用
- 提供所有必需的抽象方法实现。以下代码可作为示例。
<?php namespace App\Console\Commands; use Dainsys\RingCentral\Console\Commands\ProductionReportCommand; class PublishingProductionReport extends ProductionReportCommand { /** * The name and signature of the console command. * * @var string */ protected $signature = 'publishing:production-report {dates?} Range of dates between the data will be queried. Exc: 2023-01-01 or 2023-01-01,2023-01-02. Today\'s date will be assumed if not passed! '; /** * List of dialGroups to query. Provide all dialGroups. * * @return array */ public function dialGroups(): array { // return ['PUB%']; } /** * List of teams to query. * * @return array */ public function teams(): array { // return ['ECC%']; } /** * Email subject */ public function subject(): string { return str($this->name)->replace(':', ' ')->headline(); } }