belongsTo(Product::class, 'product_id'); } public function stock() { return $this->belongsTo(Stock::class); } public function sale(): BelongsTo { return $this->belongsTo(Sale::class, 'sale_id'); } protected $casts = [ 'sale_id' => 'integer', 'stock_id' => 'integer', 'product_id' => 'integer', 'price' => 'double', 'discount' => 'double', 'lossProfit' => 'double', 'quantities' => 'double', 'productPurchasePrice' => 'double', 'warranty_guarantee_info' => 'json', ]; }