This commit is contained in:
James Cole
2017-08-30 07:00:17 +02:00
parent b6227e633c
commit d610302e79
3 changed files with 34 additions and 40 deletions

View File

@@ -50,6 +50,20 @@ class AutoCompleteController extends Controller
}
/**
* @param JournalCollectorInterface $collector
*
* @return \Illuminate\Http\JsonResponse
*/
public function allTransactionJournals(JournalCollectorInterface $collector)
{
$collector->setLimit(250)->setPage(1);
$return = array_unique($collector->getJournals()->pluck('description')->toArray());
sort($return);
return Response::json($return);
}
/**
* Returns a JSON list of all beneficiaries.
*
@@ -134,4 +148,22 @@ class AutoCompleteController extends Controller
return Response::json($return);
}
/**
* @param JournalCollectorInterface $collector
* @param string $what
*
* @return \Illuminate\Http\JsonResponse
*/
public function transactionJournals(JournalCollectorInterface $collector, string $what)
{
$type = config('firefly.transactionTypesByWhat.' . $what);
$types = [$type];
$collector->setTypes($types)->setLimit(250)->setPage(1);
$return = array_unique($collector->getJournals()->pluck('description')->toArray());
sort($return);
return Response::json($return);
}
}