mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 20:38:57 +00:00
Updated accounts so actions will trigger cache flush.
This commit is contained in:
39
app/lib/FireflyIII/Event/Account.php
Normal file
39
app/lib/FireflyIII/Event/Account.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Event;
|
||||
|
||||
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
||||
class Account
|
||||
{
|
||||
public function destroy(\Account $account)
|
||||
{
|
||||
\Cache::forget('account.' . $account->id . '.latestBalance');
|
||||
\Cache::forget('account.' . $account->id . '.lastActivityDate');
|
||||
}
|
||||
|
||||
public function store(\Account $account)
|
||||
{
|
||||
|
||||
\Cache::forget('account.' . $account->id . '.latestBalance');
|
||||
\Cache::forget('account.' . $account->id . '.lastActivityDate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Dispatcher $events
|
||||
*/
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
// triggers when others are updated.
|
||||
$events->listen('account.store', 'FireflyIII\Event\Account@store');
|
||||
$events->listen('account.update', 'FireflyIII\Event\Account@update');
|
||||
$events->listen('account.destroy', 'FireflyIII\Event\Account@destroy');
|
||||
}
|
||||
|
||||
public function update(\Account $account)
|
||||
{
|
||||
\Cache::forget('account.' . $account->id . '.latestBalance');
|
||||
\Cache::forget('account.' . $account->id . '.lastActivityDate');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user