当前位置: 首页>>代码示例>>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;未经允许,请勿转载。