firefly-iii/app/Helpers/Csv/Mapper/Category.php

35 lines
654 B
PHP
Raw Normal View History

2015-07-05 11:18:44 -05:00
<?php
namespace FireflyIII\Helpers\Csv\Mapper;
use Auth;
use FireflyIII\Models\Category as CategoryModel;
/**
* Class Category
*
* @package FireflyIII\Helpers\Csv\Mapper
*/
class Category implements MapperInterface
{
/**
* @return array
*/
public function getMap()
{
$result = Auth::user()->categories()->get(['categories.*']);
$list = [];
/** @var CategoryModel $category */
foreach ($result as $category) {
$list[$category->id] = $category->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
}