branch_id = auth()->user()->branch_id ?? auth()->user()->active_branch_id; }); } public function product() { return $this->belongsTo(Product::class, 'product_id', 'id'); } public function stock() { return $this->belongsTo(Stock::class); } protected $casts = [ 'product_id' => 'integer', 'branch_id' => 'integer', 'stock_id' => 'integer', 'quantity' => 'double', 'purchase_price' => 'double', ]; }