forceFill([ 'id' => 15, 'total' => '30000.00', ]); $item = (new PurchaseItem)->forceFill([ 'id' => 8, 'item_nombre' => 'Comida', 'variant_attributes' => [ ['name' => 'Fecha', 'value' => ['2026-10-12']], ], 'cantidad' => 3, 'precio_unitario' => '10000.00', 'total' => '30000.00', ]); $purchase->setRelation('items', collect([$item])); $data = (new SaleDetailResource($purchase))->resolve(Request::create('/')); $this->assertSame(15, $data['id']); $this->assertSame('Comida', $data['items'][0]['product']); $this->assertSame(['2026-10-12'], $data['items'][0]['event_dates']); $this->assertSame(3, $data['items'][0]['quantity']); $this->assertSame('10000.00', $data['items'][0]['unit_price']); $this->assertSame('30000.00', $data['items'][0]['total']); $this->assertSame('30000.00', $data['total']); } }