Skip to content

Commit 4e7eff5

Browse files
committed
JT feedback
1 parent 4a50208 commit 4e7eff5

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

docs/database-collection/time-series.txt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ a parameter:
105105
$result = Schema::hasCollection('precipitation');
106106
echo $result;
107107

108-
The ``hasCollection()`` method returns a value of ``1`` if the
109-
collection exists.
108+
If the collection exists, the ``hasCollection()`` method returns a
109+
value of ``true``.
110110

111111
.. _laravel-time-series-insert:
112112

@@ -132,23 +132,11 @@ time series collection created in the :ref:`Create a Time Series Collection exam
132132
- ``location``, which stores location metadata
133133
- ``timestamp``, which stores the time of the measurement collection
134134

135-
.. code-block:: php
136-
137-
$data = [
138-
[
139-
'precipitation_mm' => 0.5,
140-
'location' => 'New York City',
141-
'timestamp' => new UTCDateTime(Carbon::create(2023, 9, 12, 0, 0, 0, 'CET')),
142-
],
143-
[
144-
'precipitation_mm' => 2.8,
145-
'location' => 'New York City',
146-
'timestamp' => new UTCDateTime(Carbon::create(2023, 9, 17, 0, 0, 0, 'CET')),
147-
],
148-
];
149-
150-
$result = DB::table('precipitation')
151-
->insert($data);
135+
.. literalinclude:: /includes/fundamentals/write-operations/WriteOperationsTest.php
136+
:language: php
137+
:dedent:
138+
:start-after: begin time series
139+
:end-before: end time series
152140

153141
.. note::
154142

docs/includes/query-builder/QueryBuilderTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,4 +665,27 @@ public function testUnset(): void
665665

666666
$this->assertIsInt($result);
667667
}
668+
669+
public function testTimeSeries(): void
670+
{
671+
// begin time series
672+
$data = [
673+
[
674+
'precipitation_mm' => 0.5,
675+
'location' => 'New York City',
676+
'timestamp' => new UTCDateTime(Carbon::create(2023, 9, 12, 0, 0, 0, 'CET')),
677+
],
678+
[
679+
'precipitation_mm' => 2.8,
680+
'location' => 'New York City',
681+
'timestamp' => new UTCDateTime(Carbon::create(2023, 9, 17, 0, 0, 0, 'CET')),
682+
],
683+
];
684+
685+
$result = DB::table('precipitation')
686+
->insert($data);
687+
// end time series
688+
689+
$this->assertIsBool($result);
690+
}
668691
}

0 commit comments

Comments
 (0)