<?php

namespace App\Models;

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

class ReturnPurchaseItem extends Model
{
    use HasFactory;
    
    public function return()
    {
        return $this->belongsTo(ReturnPurchase::class);
    }
    public function product()
    {
        return $this->belongsTo(Product::class);
    }
    public function purchase()
    {
        return $this->belongsTo(Purchase::class);
    }
    public function supplier()
    {
        return $this->belongsTo(Supplier::class)->select('id', 'name', 'phone', 'email', 'address');
    }

    //created by
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
