当前位置: 首页>>代码示例>>PHP>>正文


PHP Dashboard::user方法代码示例

本文整理汇总了PHP中Dashboard::user方法的典型用法代码示例。如果您正苦于以下问题:PHP Dashboard::user方法的具体用法?PHP Dashboard::user怎么用?PHP Dashboard::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dashboard的用法示例。


在下文中一共展示了Dashboard::user方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createDashboard

 /**
  * createDashboard
  * --------------------------------------------------
  * Creating a dashboard dedicated to braintree widgets.
  * --------------------------------------------------
  */
 private function createDashboard()
 {
     /* Creating dashboard. */
     $dashboard = new Dashboard(array('name' => 'Braintree dashboard', 'background' => TRUE, 'number' => $this->user->dashboards->max('number') + 1));
     $dashboard->user()->associate($this->user);
     $dashboard->save();
     /* Adding widgets */
     $mrrWidget = new BraintreeMrrWidget(array('position' => '{"col":1,"row":7,"size_x":4,"size_y":4}', 'state' => 'active'));
     $arrWidget = new BraintreeArrWidget(array('position' => '{"col":5,"row":7,"size_x":4,"size_y":4}', 'state' => 'active'));
     $arpuWidget = new BraintreeArpuWidget(array('position' => '{"col":9,"row":7,"size_x":4,"size_y":4}', 'state' => 'active'));
     /* Associating dashboard */
     $mrrWidget->dashboard()->associate($dashboard);
     $arrWidget->dashboard()->associate($dashboard);
     $arpuWidget->dashboard()->associate($dashboard);
     /* Saving widgets */
     $mrrWidget->save();
     $arrWidget->save();
     $arpuWidget->save();
     /* Populating data */
     $mrrWidget->collectData();
     $arrWidget->collectData();
     $arpuWidget->collectData();
 }
开发者ID:neraunzaran,项目名称:fruit-dashboard,代码行数:29,代码来源:BraintreeConnector.php

示例2: createDashboard

 /**
  * createDashboard
  * --------------------------------------------------
  * Creating a dashboard dedicated to stripe widgets.
  * --------------------------------------------------
  */
 private function createDashboard()
 {
     /* Creating dashboard. */
     $dashboard = new Dashboard(array('name' => 'Stripe dashboard', 'background' => TRUE, 'number' => $this->user->dashboards->max('number') + 1));
     $dashboard->user()->associate($this->user);
     $dashboard->save();
     /* Adding widgets */
     $mrrWidget = new StripeMrrWidget(array('position' => '{"col":1,"row":7,"size_x":4,"size_y":4}', 'state' => 'active'));
     $arrWidget = new StripeArrWidget(array('position' => '{"col":5,"row":7,"size_x":4,"size_y":4}', 'state' => 'active'));
     $arpuWidget = new StripeArpuWidget(array('position' => '{"col":9,"row":7,"size_x":4,"size_y":4}', 'state' => 'active'));
     /* Associating dashboard */
     $mrrWidget->dashboard()->associate($dashboard);
     $arrWidget->dashboard()->associate($dashboard);
     $arpuWidget->dashboard()->associate($dashboard);
     /* Saving widgets */
     $mrrWidget->save();
     $arrWidget->save();
     $arpuWidget->save();
     /* Creating data for the last 30 days. */
     $calculator = new StripeLastMonthCalculator($this->user);
     $lastMonthData = $calculator->getLastMonthData();
     $mrrWidget->data->raw_value = json_encode($lastMonthData['mrr']);
     $arrWidget->data->raw_value = json_encode($lastMonthData['arr']);
     $arpuWidget->data->raw_value = json_encode($lastMonthData['arpu']);
     $mrrWidget->data->save();
     $arrWidget->data->save();
     $arpuWidget->data->save();
     $mrrWidget->state = 'active';
     $arrWidget->state = 'active';
     $arpuWidget->state = 'active';
     /* Saving widgets */
     $mrrWidget->save();
     $arrWidget->save();
     $arpuWidget->save();
 }
开发者ID:neraunzaran,项目名称:fruit-dashboard,代码行数:41,代码来源:StripeConnector.php


注:本文中的Dashboard::user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。