Expand code to be able to handle updates.

This commit is contained in:
James Cole
2018-02-21 08:51:30 +01:00
parent f16760d607
commit e9b6b45fc4
8 changed files with 643 additions and 21 deletions

View File

@@ -26,6 +26,7 @@ use Carbon\Carbon;
use ExpandedForm;
use FireflyIII\Events\StoredTransactionJournal;
use FireflyIII\Events\UpdatedTransactionJournal;
use FireflyIII\Factory\TransactionJournalFactory;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\JournalFormRequest;
@@ -341,9 +342,10 @@ class SingleController extends Controller
$data = $request->getJournalData();
// todo call factory instead of repository
$journal = $repository->store($data);
$factory = app(TransactionJournalFactory::class);
$factory->setUser(auth()->user());
$journal = $repository->store($data);
//$journal = $repository->store($data);
if (null === $journal->id) {
// error!
Log::error('Could not store transaction journal: ', $journal->getErrors()->toArray());