<?php

namespace App\Models;

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

class TradeGiftCard extends Model
{
    use HasFactory;
    protected static function booted()
    {
        static::creating(function ($model) {
            $model->_id = Str::uuid();
        });


    }

    public function getTradeRequest($id){
        $tr= TradeRequests::where('trade_id',$id)->select('id')->first();
        if($tr)
            return $tr->id;
        else
            return null;
    }
}
