本文整理汇总了PHP中Subscription::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::all方法的具体用法?PHP Subscription::all怎么用?PHP Subscription::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unload
public function unload()
{
$subscriptions = \Subscription::all();
$columns = ["email", "created_at"];
$firstRow = ["Email", "Дата создания"];
return $this->unloadToCsv($subscriptions, ['columns' => $columns, 'firstRow' => $firstRow]);
}
示例2: testCreateUpdateListCancel
public function testCreateUpdateListCancel()
{
$planID = 'gold-' . self::generateRandomString(20);
self::retrieveOrCreatePlan($planID);
$customer = self::createTestCustomer();
$sub = Subscription::create(array('plan' => $planID, 'customer' => $customer->id));
$this->assertSame($sub->status, 'active');
$this->assertSame($sub->plan->id, $planID);
$sub->quantity = 2;
$sub->save();
$sub = Subscription::retrieve($sub->id);
$this->assertSame($sub->status, 'active');
$this->assertSame($sub->plan->id, $planID);
$this->assertSame($sub->quantity, 2);
// Update the quantity parameter one more time
$sub = Subscription::update($sub->id, array("quantity" => 3));
$this->assertSame($sub->status, 'active');
$this->assertSame($sub->plan->id, $planID);
$this->assertSame($sub->quantity, 3);
$subs = Subscription::all(array('customer' => $customer->id, 'plan' => $planID, 'limit' => 3));
$this->assertSame(get_class($subs->data[0]), 'Stripe\\Subscription');
$sub->cancel(array('at_period_end' => true));
$sub = Subscription::retrieve($sub->id);
$this->assertSame($sub->status, 'active');
$this->assertTrue($sub->cancel_at_period_end);
}
示例3: testAll
public function testAll()
{
$planID = 'gold-' . self::randomString();
self::retrieveOrCreatePlan($planID);
$customer = self::createTestCustomer();
$sub = Subscription::create(array('customer' => $customer->id, 'plan' => $planID));
$planID_2 = 'gold-2-' . self::randomString();
self::retrieveOrCreatePlan($planID_2);
$sub_2 = Subscription::create(array('customer' => $customer->id, 'plan' => $planID_2));
$subs = Subscription::all(array('limit' => 2, 'offset' => 0));
$this->assertSame(2, count($subs['data']));
}
示例4: filter
function filter($condition = FALSE)
{
switch ($condition) {
case 'active':
$this->view_data['subscriptions'] = Subscription::find('all', array('conditions' => array('status = ?', 'Active')));
break;
case 'inactive':
$this->view_data['subscriptions'] = Subscription::find('all', array('conditions' => array('status = ?', 'Inactive')));
break;
default:
$this->view_data['subscriptions'] = Subscription::all();
break;
}
$this->content_view = 'subscriptions/all';
}
示例5: session
protected function session($user)
{
$this->setUser($user);
$now = strftime("%Y-%m-%d", strtotime('now'));
$session = Registry::get("session");
$subscriptions = array();
$subscription = \Subscription::all(array("user_id = ?" => $user->id, "live = ?" => true, "expiry > ?" => $now), array("item_id"));
foreach ($subscription as $s) {
$item = \Item::first(array("id = ?" => $s->item_id), array("name"));
array_push($subscriptions, $item->name);
}
$session->set("subscriptions", $subscriptions);
}
示例6: subscribed
/**
* @before _secure, _admin
*/
public function subscribed($user_id)
{
$this->seo(array("title" => "Subscriptions", "keywords" => "admin", "description" => "admin", "view" => $this->getLayoutView()));
$view = $this->getActionView();
$subscriptions = Subscription::all(array("user_id = ?" => $user_id), array("item_id", "created", "expiry"));
$view->set("subs", $subscriptions);
}