dainsys/ring_central

一个全栈包,用于向Laravel应用程序添加ring_central功能。

v0.2.2 2023-03-01 19:27 UTC

This package is auto-updated.

Last update: 2024-09-29 23:03:29 UTC


README

扩展ring central报告功能。

安装

  1. 需要使用composer: composer require dainsys/ring_central
  2. 在您的.env文件中添加DB连接值
RC_DB_HOST=
RC_DB_DATABASE=
RC_DB_USERNAME=
RC_DB_PASSWORD=
RC_DB_DRIVER=
  1. 运行迁移: php artisan migrate

用法

  1. 请确保您的命令扩展了\Dainsys\RingCentral\Console\Commands\AbstractProductionReportCommand。或者,您也可以使用rc:make-command命令来创建报告。
  2. 您的签名属性必须提供dates所需的属性,这是运行报告所必需的。如果没有提供,将假定今天是日期。
  3. 此包在底层使用dainsys/mailing更多信息。或者,请确保提供recipients方法的实现。
    1. 使用dainsys/mailing
      1. 访问您的应用中的URL /mailing/admin/mailables,创建一个带有命令类名的mailable记录。例如,当前示例为App\Console\Commands\PublishingProductionReport
      2. 访问URL /mailing/admin/recipients来创建新的接收者,并将它们与创建的mailable报告关联起来。
    2. 在您的报告命令中提供自己的实现
       protected function recipients(): array
       {
           return [];
       }
  4. 提供所有必需的抽象方法实现。以下代码可作为示例。
<?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();
   }
}