51 lines
850 B
PHP
51 lines
850 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class AffiliatorFeeLedger extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
|
|
protected $table = 'affiliator_fee_ledgers';
|
|
|
|
protected $fillable = [
|
|
'affiliator_id',
|
|
'amount',
|
|
'status',
|
|
'time',
|
|
'transaction_type',
|
|
'transaction_id'
|
|
|
|
];
|
|
|
|
protected $casts = [
|
|
'amount' => 'integer',
|
|
];
|
|
|
|
public function affiliator()
|
|
{
|
|
return $this->belongsTo(Affiliator::class);
|
|
}
|
|
|
|
public function transaction()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
|
|
public function getTitleAttribute()
|
|
{
|
|
|
|
if ($this->transaction_type == "App\Models\AffiliatorWithdraw") {
|
|
return "Penarikan Saldo";
|
|
}
|
|
|
|
|
|
return "-";
|
|
}
|
|
}
|