added relationships for mining taxes

This commit is contained in:
2021-02-22 19:09:11 +09:00
parent e14f9c0764
commit 02db5ce9a1
6 changed files with 52 additions and 4 deletions

View File

@@ -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;
}
}

View File

@@ -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');
}
}

View File

@@ -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');
}
}

View File

@@ -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');
}
}