skiftet/speakout-api-client

2.3.3 2022-09-01 21:14 UTC

This package is auto-updated.

Last update: 2024-09-29 04:14:29 UTC


README

安装

在您的项目根目录中运行 composer require skiftet/speakout-api-client 以安装该包。

使用方法

注意:该API目前只能与尚未发布的Speakout API的开发版本一起使用

use Skiftet\Speakout\Api\Client as Speakout;

$speakout = new Speakout([
    'endpoint' => '', // Set this to the url of a running Speakout deployment. E.g. 'https://:3000'
    'user'     => '', // The username of a Speakout user
    'password' => '', // The correponding password
]);

/**
 * This will load request an array with all campaigns
 */
$campaigns = $speakout->campaigns()->all();

/**
 * This will request an array with all campaigns, sorted by action count
 */
$campaigns = $speakout->campaigns()->orderBy('actions')->get();

/**
 * You can also do nested queries for deeper filters. The example below will only
 * take actions since the 1st of March 2017 into account.
 */
$campaigns = $speakout->campaigns()->orderBy('actions')->has('actions', function (Query $query) {
    return $query->since('2017-03-01'); // this can also be an instance of \DateTime
})->get();

待办事项

  • 实现创建新操作
  • 填充的模型
  • 决定是否为模型使用活动记录或数据映射模式
  • 模型关系的懒加载