*/ protected $fillable = [ 'name', 'description', 'price', 'image', 'category', 'stock', 'status' ]; protected $casts = [ 'price' => 'decimal:2', 'stock' => 'integer' ]; /** * Get the orders for the product. */ public function orders() { return $this->belongsToMany(Order::class, 'order_products') ->withPivot('quantity', 'price', 'total') ->withTimestamps(); } }