added relationships for mining taxes
This commit is contained in:
@@ -114,6 +114,7 @@ class FetchMiningTaxesLedgersJob implements ShouldQueue
|
||||
$item = Ledger::updateOrCreate([
|
||||
'character_id' => $ledger->character_id,
|
||||
'character_name' => $charName,
|
||||
'observer_id' => $this->observerId,
|
||||
'last_updated' => $updated,
|
||||
'type_id' => $ledger->type_id,
|
||||
'ore_name' => $typeName,
|
||||
@@ -122,6 +123,7 @@ class FetchMiningTaxesLedgersJob implements ShouldQueue
|
||||
], [
|
||||
'character_id' => $ledger->character_id,
|
||||
'character_name' => $charName,
|
||||
'observer_id' => $this->observerId,
|
||||
'last_updated' => $updated,
|
||||
'type_id' => $ledger->type_id,
|
||||
'ore_name' => $typeName,
|
||||
|
||||
@@ -26,4 +26,28 @@ class Invoice extends Model
|
||||
'date_due',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function getPayment() {
|
||||
return $this->hasMany('App\Models\MiningTax\Payment', 'invoice_id', 'invoice_id');
|
||||
}
|
||||
|
||||
public function getCharacterId() {
|
||||
return $this->character_id;
|
||||
}
|
||||
|
||||
public function getCharacterName() {
|
||||
return $this->character_name;
|
||||
}
|
||||
|
||||
public function getStatus() {
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function getLedgers() {
|
||||
return $this->hasMany('App\Models\MiningTax\Ledger', 'invoice_id', 'invoice_id');
|
||||
}
|
||||
|
||||
public function getInvoiceAmount() {
|
||||
return $this->invoice_amount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ledger extends Model
|
||||
{
|
||||
|
||||
use ReplaceableModel;
|
||||
|
||||
//Table Name
|
||||
protected $table = 'alliance_mining_tax_ledgers';
|
||||
|
||||
@@ -19,6 +22,8 @@ class Ledger extends Model
|
||||
*/
|
||||
protected $fillable = [
|
||||
'character_id',
|
||||
'character_name',
|
||||
'observer_id',
|
||||
'last_updated',
|
||||
'type_id',
|
||||
'ore_name',
|
||||
@@ -27,4 +32,10 @@ class Ledger extends Model
|
||||
'invoiced',
|
||||
'invoice_id',
|
||||
];
|
||||
|
||||
public function getInvoice() {
|
||||
return $this->belongsTo('App\Models\MiningTax\Invoice', 'invoice_id', 'invoice_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,4 +22,10 @@ class Observer extends Model
|
||||
'observer_id',
|
||||
'observer_type',
|
||||
];
|
||||
|
||||
public function getLedgers() {
|
||||
return $this->hasMany('App\Models\MiningTax\Ledger', 'observer_id', 'observer_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,4 +26,8 @@ class Payment extends Model
|
||||
'payment_date',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function getInvoice() {
|
||||
return $this->belongsTo('App\Models\MiningTax\Invoice', 'invoice_id', 'invoice_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ class CreateMiningTaxTables extends Migration
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('character_id');
|
||||
$table->string('character_name');
|
||||
$table->unsignedBigInteger('invoice_id');
|
||||
$table->float('invoice_amount');
|
||||
$table->unsignedBigInteger('invoice_id')->nullable();
|
||||
$table->float('invoice_amount')->default(0.00);
|
||||
$table->dateTime('date_issued');
|
||||
$table->dateTime('date_due');
|
||||
$table->enum('status', [
|
||||
@@ -49,9 +49,10 @@ class CreateMiningTaxTables extends Migration
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('character_id');
|
||||
$table->string('character_name');
|
||||
$table->unsignedBigInteger('observer_id')->nullable();
|
||||
$table->dateTime('last_updated');
|
||||
$table->unsignedBigInteger('type_id');
|
||||
$table->string('ore_name');
|
||||
$table->unsignedBigInteger('type_id')->default(0);
|
||||
$table->string('ore_name')->default('None');
|
||||
$table->unsignedBigInteger('quantity');
|
||||
$table->decimal('amount', 20, 2)->default(0.00);
|
||||
$table->enum('invoiced', [
|
||||
|
||||
Reference in New Issue
Block a user