Move stuff to request classes for #339

This commit is contained in:
James Cole
2016-10-23 12:10:22 +02:00
parent 83f48418f6
commit 9a30fbd05a
15 changed files with 129 additions and 91 deletions

View File

@@ -175,7 +175,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*/
public function store(array $data): PiggyBank
{
$piggyBank = PiggyBank::create($data);
$data['order'] = $this->getMaxOrder() + 1;
$piggyBank = PiggyBank::create($data);
$this->updateNote($piggyBank, $data['note']);
@@ -232,9 +233,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
return true;
}
$dbNote= $piggyBank->notes()->first();
$dbNote = $piggyBank->notes()->first();
if (is_null($dbNote)) {
$dbNote= new Note();
$dbNote = new Note();
$dbNote->noteable()->associate($piggyBank);
}
$dbNote->text = trim($note);