From b55fd6a5e5da6d11f603a809051cd914a013ed07 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Thu, 13 Dec 2018 01:43:51 -0600 Subject: [PATCH] bunch of updates --- app/Library/FinanceHelper.php | 9 +++-- app/Models/Finances/PlayerDonationJournal.php | 40 +++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 app/Models/Finances/PlayerDonationJournal.php diff --git a/app/Library/FinanceHelper.php b/app/Library/FinanceHelper.php index e51640534..f5d7b84fb 100644 --- a/app/Library/FinanceHelper.php +++ b/app/Library/FinanceHelper.php @@ -13,6 +13,7 @@ use App\Models\Esi\EsiScope; use App\Models\Esi\EsiToken; use App\Models\Corporation\CorpJournal; use App\Models\User\UserToCorporation; +use App\Models\Finances\PlayerDonationJourna; use App\Library\Esi; @@ -138,9 +139,9 @@ class FinanceHelper { $date = $esiHelper->DecodeDate($journal['date']); if($journal['ref_type'] == 'player_donation') { - $check = DB::table('PlayerDonationJournals')->where('id', $journal['id'])->get(); + //$check = DB::table('PlayerDonationJournals')->where('id', $journal['id'])->get(); //if we don't find the journal entry, add the journal entry to the database - if($check->count() == 0) { + if(!PlayerDonationJournal::where('id', $journal['id'])->exists()) { $entry = new CorpJournal; $entry->id = $journal['id']; $entry->corporation_id = $corpId; @@ -178,9 +179,9 @@ class FinanceHelper { $entry->save(); } } else { - $check = DB::table('CorpJournals')->where('id', $journal['id'])->get(); + //$check = DB::table('CorpJournals')->where('id', $journal['id'])->get(); //if we don't find the journal entry, add the journal entry to the database - if($check->count() == 0) { + if(CorpJournal::where('id', $journal['id'])->exists()) { $entry = new CorpJournal; $entry->id = $journal['id']; $entry->corporation_id = $corpId; diff --git a/app/Models/Finances/PlayerDonationJournal.php b/app/Models/Finances/PlayerDonationJournal.php new file mode 100644 index 000000000..15af626e3 --- /dev/null +++ b/app/Models/Finances/PlayerDonationJournal.php @@ -0,0 +1,40 @@ +