vd/app/Models/Real/Order.php
2018-11-07 17:56:50 +08:00

41 lines
1016 B
PHP

<?php
namespace App\Models\Real;
use App\Core\Model;
use App\Models\Card;
class Order extends Model
{
protected $table = 'orders';
public $incrementing = false;
protected $dates = ['order_at', 'service_start_at', 'service_end_at'];
public function cardBases()
{
return $this->belongsToMany(Card::class, 'real_order_base_card_relations', 'order_id', 'sim');
}
public function cardRenewals()
{
return $this->belongsToMany(Card::class, 'real_order_renewal_card_relations', 'order_id', 'sim');
}
public function cardFlows()
{
return $this->belongsToMany(Card::class, 'real_order_flows_card_relations', 'order_id', 'sim');
}
public function cardOptional()
{
return $this->belongsToMany(Card::class, 'real_order_optional_card_relations', 'order_id', 'sim');
}
public function cardAdditional()
{
return $this->belongsToMany(Card::class, 'real_order_additional_card_relations', 'order_id', 'sim');
}
}