Check for double files and some code clean up.

This commit is contained in:
James Cole
2015-07-18 21:46:16 +02:00
parent 73e526645e
commit ed12ea7cfb
4 changed files with 120 additions and 81 deletions

View File

@@ -311,16 +311,29 @@ class TransactionController extends Controller
/**
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
* @param AttachmentHelperInterface $att
* @param TransactionJournal $journal
*
* @return \Illuminate\Http\RedirectResponse
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, AttachmentHelperInterface $att, TransactionJournal $journal)
{
$journalData = $request->getJournalData();
$repository->update($journal, $journalData);
// save attachments:
$att->saveAttachmentsForModel($journal);
if ($att->getErrors()->count() > 0) {
// todo moet beter
Session::flash('error', '<ul>' . join('', $att->getErrors()->get('attachments', '<li>:message</li>')) . '</ul>');
}
if ($att->getMessages()->count() > 0) {
// todo moet beter
Session::flash('info', '<ul>' . join('', $att->getMessages()->get('attachments', '<li>:message</li>')) . '</ul>');
}
event(new JournalSaved($journal));
// update, get events by date and sort DESC