Lots of cleaning up.

This commit is contained in:
James Cole
2015-07-26 19:07:02 +02:00
parent 450baba56a
commit 3e05fd91d9
18 changed files with 135 additions and 846 deletions

View File

@@ -2,6 +2,7 @@
namespace FireflyIII\Support;
use Auth;
use Carbon\Carbon;
use DB;
use FireflyIII\Models\Account;
@@ -14,6 +15,28 @@ use FireflyIII\Models\Transaction;
*/
class Steam
{
/**
* @param array $accounts
*
* @return array
*/
public function getLastActivities(array $accounts)
{
$list = [];
$set = Auth::user()->transactions()
->whereIn('account_id', $accounts)
->groupBy('account_id')
->get(['transactions.account_id', DB::Raw('MAX(`transaction_journals`.`date`) as `max_date`')]);
foreach ($set as $entry) {
$list[intval($entry->account_id)] = new Carbon($entry->max_date);
}
return $list;
}
/**
*
* @param \FireflyIII\Models\Account $account