firefly-iii/app/Helpers/Csv/Converter/BudgetId.php

31 lines
663 B
PHP
Raw Normal View History

2015-07-05 08:16:44 -05:00
<?php
2016-02-05 05:08:25 -06:00
declare(strict_types = 1);
2015-07-05 08:16:44 -05:00
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Budget;
/**
2016-01-19 01:48:38 -06:00
* Class BudgetId
2015-07-05 08:16:44 -05:00
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class BudgetId extends BasicConverter implements ConverterInterface
{
/**
* @return Budget
*/
public function convert()
{
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]);
} else {
$budget = Auth::user()->budgets()->find($this->value);
}
return $budget;
}
2015-07-09 14:26:40 -05:00
}