當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。