本文整理汇总了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;
}