<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ActivityIntroduceLog extends BaseModel
{
    use HasFactory;

    public const INTRODUCETYPE = "INTRODUCE";
    public const SIGNINTYPE = "SIGNIN";
    public const REFUNDTYPE = "REFUND";

    public function scopeIntroduceOrder($query, $order_id)
    {
        return $query->where("introduce_order_id", $order_id);
    }

    public function scopeIntroduceType($query)
    {
        return $query->where("type", "INTRODUCE");
    }

    public function activityOrder()
    {
        return $this->hasOne(ActivityOrder::class,'id', 'order_id');
    }

    public function order()
    {
        return $this->belongsTo(ActivityOrder::class, 'order_id', 'id');
    }
}
