2016-10-15 12:39:34 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* JournalTasker.php
|
2017-10-21 08:40:00 +02:00
|
|
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
2016-10-15 12:39:34 +02:00
|
|
|
*
|
2017-10-21 08:40:00 +02:00
|
|
|
* This file is part of Firefly III.
|
2016-10-15 12:39:34 +02:00
|
|
|
*
|
2017-10-21 08:40:00 +02:00
|
|
|
* Firefly III is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Firefly III is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2017-12-17 14:44:05 +01:00
|
|
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
2016-10-15 12:39:34 +02:00
|
|
|
*/
|
2017-04-09 07:44:22 +02:00
|
|
|
declare(strict_types=1);
|
2016-10-15 12:39:34 +02:00
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\Journal;
|
|
|
|
|
|
|
|
use DB;
|
2016-11-19 12:57:35 +01:00
|
|
|
use FireflyIII\Models\AccountType;
|
2016-10-29 11:42:04 +02:00
|
|
|
use FireflyIII\Models\PiggyBankEvent;
|
2016-10-15 12:39:34 +02:00
|
|
|
use FireflyIII\Models\Transaction;
|
|
|
|
use FireflyIII\Models\TransactionJournal;
|
|
|
|
use FireflyIII\User;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
use Illuminate\Database\Query\JoinClause;
|
2016-10-21 19:06:22 +02:00
|
|
|
use Illuminate\Support\Collection;
|
2017-02-19 07:34:39 +01:00
|
|
|
use Steam;
|
2016-10-15 12:39:34 +02:00
|
|
|
|
|
|
|
/**
|
2017-11-15 12:25:49 +01:00
|
|
|
* Class JournalTasker.
|
2016-10-15 12:39:34 +02:00
|
|
|
*/
|
|
|
|
class JournalTasker implements JournalTaskerInterface
|
|
|
|
{
|
|
|
|
/** @var User */
|
|
|
|
private $user;
|
|
|
|
|
2016-10-21 19:06:22 +02:00
|
|
|
/**
|
2018-02-28 21:32:59 +01:00
|
|
|
* @deprecated
|
|
|
|
*
|
2016-10-21 19:06:22 +02:00
|
|
|
* @param TransactionJournal $journal
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getPiggyBankEvents(TransactionJournal $journal): Collection
|
|
|
|
{
|
|
|
|
/** @var Collection $set */
|
|
|
|
$events = $journal->piggyBankEvents()->get();
|
|
|
|
$events->each(
|
|
|
|
function (PiggyBankEvent $event) {
|
|
|
|
$event->piggyBank = $event->piggyBank()->withTrashed()->first();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
return $events;
|
|
|
|
}
|
|
|
|
|
2017-01-30 16:42:58 +01:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*/
|
|
|
|
public function setUser(User $user)
|
|
|
|
{
|
|
|
|
$this->user = $user;
|
|
|
|
}
|
2016-10-23 12:42:44 +02:00
|
|
|
}
|