<?php

namespace App\Models;

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

class S2ShopOrder extends Model
{
    use HasFactory;

    public $table = "s2_shop_order";

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

    public function lottoCodes()
    {
        return $this->hasMany(LottoCode::class, 'order_id', 'id');
    }

    public function shopExpress()
    {
        return $this->hasMany(S2ShopExpress::class, 'order_id', 'id');
    }

    public function agentUser()
    {
        return $this->hasOne(AgentUser::class, 'user_id', 'user_id');
    }

    public function user() {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }
}
