2015-07-05 11:18:44 -05:00
|
|
|
<?php
|
2016-02-05 05:08:25 -06:00
|
|
|
declare(strict_types = 1);
|
2015-07-05 11:18:44 -05:00
|
|
|
namespace FireflyIII\Helpers\Csv\Mapper;
|
|
|
|
|
|
|
|
use Auth;
|
|
|
|
use FireflyIII\Models\Budget as BudgetModel;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Budget
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Helpers\Csv\Mapper
|
|
|
|
*/
|
|
|
|
class Budget implements MapperInterface
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getMap()
|
|
|
|
{
|
|
|
|
$result = Auth::user()->budgets()->get(['budgets.*']);
|
|
|
|
$list = [];
|
|
|
|
|
|
|
|
/** @var BudgetModel $budget */
|
|
|
|
foreach ($result as $budget) {
|
|
|
|
$list[$budget->id] = $budget->name;
|
|
|
|
}
|
|
|
|
asort($list);
|
|
|
|
|
2015-07-09 12:36:14 -05:00
|
|
|
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
2015-07-06 01:14:19 -05:00
|
|
|
|
2015-07-05 11:18:44 -05:00
|
|
|
return $list;
|
|
|
|
}
|
2015-07-09 14:26:40 -05:00
|
|
|
}
|