mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Form for issue #6 is complete, final checks about to be written. Mebbe tomorrow. [skip ci]
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Firefly\Storage\Piggybank;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
/**
|
||||
@@ -74,7 +75,19 @@ class EloquentPiggybankRepository implements PiggybankRepositoryInterface
|
||||
|
||||
$piggyBank = new \Piggybank($data);
|
||||
$piggyBank->account()->associate($account);
|
||||
$today = new Carbon;
|
||||
if ($piggyBank->validate()) {
|
||||
echo 'Valid, but some more checking!';
|
||||
if($piggyBank->targetdate < $today) {
|
||||
$piggyBank->errors()->add('targetdate','Target date cannot be in the past.');
|
||||
echo 'errrrrrr on target date';
|
||||
return $piggyBank;
|
||||
}
|
||||
|
||||
// first period for reminder is AFTER target date.
|
||||
// just flash a warning
|
||||
die('Here be a check. Sorry for the kill-switch. Will continue tomorrow.');
|
||||
|
||||
$piggyBank->save();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user