mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 02:57:45 +00:00
Expand services.
This commit is contained in:
@@ -334,17 +334,44 @@ class SingleController extends Controller
|
||||
* @param JournalRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
|
||||
{
|
||||
$doSplit = 1 === intval($request->get('split_journal'));
|
||||
$createAnother = 1 === intval($request->get('create_another'));
|
||||
$data = $request->getJournalData();
|
||||
|
||||
$doSplit = 1 === intval($request->get('split_journal'));
|
||||
$createAnother = 1 === intval($request->get('create_another'));
|
||||
$data = $request->getJournalData();
|
||||
$data['user'] = auth()->user()->id;
|
||||
$data['bill_id'] = null;
|
||||
$data['bill_name'] = null;
|
||||
$data['piggy_bank_name'] = null;
|
||||
$data['transactions'] = [
|
||||
[
|
||||
'amount' => $data['amount'],
|
||||
'currency_id' => $data['currency_id'],
|
||||
'description' => null,
|
||||
'reconciled' => false,
|
||||
'identifier' => 0,
|
||||
'currency_code' => null,
|
||||
'budget_id' => $data['budget_id'],
|
||||
'budget_name' => null,
|
||||
'category_id' => null,
|
||||
'category_name' => $data['category'],
|
||||
'source_id' => (int)$data['source_account_id'],
|
||||
'source_name' => $data['source_account_name'],
|
||||
'destination_id' => (int)$data['destination_account_id'],
|
||||
'destination_name' => $data['destination_account_name'],
|
||||
'foreign_currency_id' => null,
|
||||
'foreign_currency_code' => null,
|
||||
'foreign_amount' => null,
|
||||
],
|
||||
];
|
||||
var_dump($data);exit;
|
||||
// todo call factory instead of repository
|
||||
/** @var TransactionJournalFactory $factory */
|
||||
$factory = app(TransactionJournalFactory::class);
|
||||
$factory->setUser(auth()->user());
|
||||
$journal = $repository->store($data);
|
||||
$journal = $factory->create($data);
|
||||
//$journal = $repository->store($data);
|
||||
if (null === $journal->id) {
|
||||
// error!
|
||||
|
Reference in New Issue
Block a user