bunch of updates

This commit is contained in:
2018-12-13 01:43:51 -06:00
parent 4a16086898
commit b55fd6a5e5
2 changed files with 45 additions and 4 deletions
+5 -4
View File
@@ -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;
@@ -0,0 +1,40 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class PlayerDonationJournal extends Model
{
/**
* Table Name
*/
protected $table = 'PlayerDonationJournals';
/**
* Timestamps
*/
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'corporation_id',
'division',
'amount',
'balance',
'context_id',
'context_id_type',
'date',
'description',
'first_party_id',
'reason',
'ref_type',
'second_party_id',
'tax',
'tax_receiver_id',
];
}