44 lines
909 B
PHP
44 lines
909 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class VoucherSale extends Model
|
|
{
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'unit_price' => 'decimal:2', 'discount_amount' => 'decimal:2',
|
|
'total_amount' => 'decimal:2', 'pricing_snapshot' => 'array',
|
|
];
|
|
}
|
|
|
|
public function tenant()
|
|
{
|
|
return $this->belongsTo(Tenant::class);
|
|
}
|
|
|
|
public function agent()
|
|
{
|
|
return $this->belongsTo(VoucherAgent::class, 'voucher_agent_id');
|
|
}
|
|
|
|
public function packageProfile()
|
|
{
|
|
return $this->belongsTo(NasPackageProfile::class, 'nas_package_profile_id');
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function vouchers()
|
|
{
|
|
return $this->hasMany(HotspotVoucher::class);
|
|
}
|
|
}
|