mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-22 22:43:20 -06:00
35 lines
687 B
PHP
35 lines
687 B
PHP
<?php
|
|
declare(strict_types = 1);
|
|
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(): array
|
|
{
|
|
$result = Auth::user()->categories()->get(['categories.*']);
|
|
$list = [];
|
|
|
|
/** @var CategoryModel $category */
|
|
foreach ($result as $category) {
|
|
$list[$category->id] = $category->name;
|
|
}
|
|
asort($list);
|
|
|
|
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
|
|
|
return $list;
|
|
}
|
|
}
|