mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Remove reminders when piggy bank is reminded.
This commit is contained in:
parent
e11e53913a
commit
02e55496df
@ -15,6 +15,8 @@ use Redirect;
|
|||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
use URL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionController
|
* Class TransactionController
|
||||||
@ -291,7 +293,7 @@ class TransactionController extends Controller
|
|||||||
return Redirect::route('transactions.create', $request->input('what'))->withInput();
|
return Redirect::route('transactions.create', $request->input('what'))->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::route('transactions.index', $request->input('what'));
|
return Redirect::to(URL::previous());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +320,7 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Redirect::route('transactions.index', $journalData['what']);
|
return Redirect::to(URL::previous());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
|
|||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
use Log;
|
use Log;
|
||||||
|
use Reminder;
|
||||||
/**
|
/**
|
||||||
* Class EventServiceProvider
|
* Class EventServiceProvider
|
||||||
*
|
*
|
||||||
@ -60,6 +60,15 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
PiggyBank::deleting(function(PiggyBank $piggyBank) {
|
||||||
|
$reminders = $piggyBank->reminders()->get();
|
||||||
|
/** @var Reminder $reminder */
|
||||||
|
foreach($reminders as $reminder) {
|
||||||
|
$reminder->delete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Account::deleted(
|
Account::deleted(
|
||||||
function (Account $account) {
|
function (Account $account) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user