當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Icon::all方法代碼示例

本文整理匯總了PHP中Icon::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Icon::all方法的具體用法?PHP Icon::all怎麽用?PHP Icon::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Icon的用法示例。


在下文中一共展示了Icon::all方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: doExport

 public function doExport()
 {
     $filename = 'firefly-export-' . date('Y-m-d') . '.json';
     $data = array();
     // accounts
     $accounts = Auth::user()->accounts()->get();
     foreach ($accounts as $account) {
         $account->name = Crypt::decrypt($account->name);
         $account->balance = floatval($account->balance);
         $data['accounts'][] = $account->toArray();
     }
     // icons
     $icons = Icon::all();
     foreach ($icons as $i) {
         $data['icons'][] = $i->toArray();
     }
     // beneficiaries
     $bene = Auth::user()->beneficiaries()->get();
     foreach ($bene as $b) {
         $b->name = Crypt::decrypt($b->name);
         $data['beneficiaries'][] = $b->toArray();
     }
     // budgets
     $budgets = Auth::user()->budgets()->get();
     foreach ($budgets as $budget) {
         $budget->name = Crypt::decrypt($budget->name);
         $budget->amount = floatval($budget->amount);
         $data['budgets'][] = $budget->toArray();
     }
     // categories
     $categories = Auth::user()->categories()->get();
     foreach ($categories as $cat) {
         $cat->name = Crypt::decrypt($cat->name);
         $data['categories'][] = $cat->toArray();
     }
     // targets
     $targets = Auth::user()->targets()->get();
     foreach ($targets as $target) {
         $target->description = Crypt::decrypt($target->description);
         $target->amount = floatval($target->amount);
         $data['targets'][] = $target->toArray();
     }
     // transactions
     $transactions = Auth::user()->transactions()->get();
     foreach ($transactions as $transaction) {
         $transaction->description = Crypt::decrypt($transaction->description);
         $transaction->amount = floatval($transaction->amount);
         $data['transactions'][] = $transaction->toArray();
     }
     // transfers
     $transfers = Auth::user()->transfers()->get();
     foreach ($transfers as $transfer) {
         $transfer->description = Crypt::decrypt($transfer->description);
         $transfer->amount = floatval($transfer->amount);
         $data['transfers'][] = $transfer->toArray();
     }
     // settings:
     $settings = Auth::user()->settings()->get();
     foreach ($settings as $setting) {
         $setting->value = Crypt::decrypt($setting->value);
         $data['settings'][] = $setting->toArray();
     }
     $payload = json_encode($data, JSON_PRETTY_PRINT);
     // We'll be outputting a PDF
     header('Content-Description: File Transfer');
     header('Content-Type: application/octet-stream');
     header('Content-Disposition: attachment; filename=' . $filename);
     header('Content-Transfer-Encoding: binary');
     header('Expires: 0');
     header('Cache-Control: must-revalidate');
     header('Pragma: public');
     header('Content-Length: ' . strlen($payload));
     echo $payload;
     exit;
 }
開發者ID:jcyh,項目名稱:nder-firefly,代碼行數:75,代碼來源:ImportController.php


注:本文中的Icon::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。