Skip to content

Commit 9719367

Browse files
author
Chris Cho
committed
tweaks
1 parent fab7501 commit 9719367

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

docs/eloquent-models/schema-builder.txt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ Schema Builder
1111
.. meta::
1212
:keywords: php framework, odm, code example, schema facade, php artisan, eloquent, blueprint, artisan, migrate
1313

14+
.. contents:: On this page
15+
:local:
16+
:backlinks: none
17+
:depth: 2
18+
:class: singlecol
19+
1420
Overview
1521
--------
1622

@@ -24,8 +30,8 @@ in the Laravel ``Schema`` facade.
2430
To learn more about facades, see `Facades <https://laravel.com/docs/{+laravel-docs-version+}/facades>`__
2531
in the Laravel documentation.
2632

27-
The following sections describe the Laravel schema builder and functionality
28-
available in {+odm-short+} and show examples of how to use them:
33+
The following sections describe the Laravel schema builder features available
34+
in {+odm-short+} and show examples of how to use them:
2935

3036
- :ref:`<laravel-eloquent-migrations>`
3137
- :ref:`<laravel-eloquent-collection-exists>`
@@ -66,17 +72,18 @@ following changes to perform the schema changes on your MongoDB database:
6672
file so that PHP artisan performs the migration on the correct database.
6773

6874
The following example migration creates a collection and index when you run
69-
the migration and drops it when you roll back the migration:
75+
the migration and drops them when you roll back the migration:
7076

7177
.. literalinclude:: /includes/schema-builder/astronauts_migration.php
78+
:dedent:
7279
:language: php
7380
:emphasize-lines: 4, 10
7481

7582
Run or Roll Back a Migration
7683
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7784

7885
To run the database migration from a class file, run the following PHP artisan
79-
command:
86+
command after replacing the placeholder:
8087

8188
.. code-block:: bash
8289

@@ -86,7 +93,8 @@ This artisan command runs the ``up()`` function in the class file to create
8693
the collection and index in the database specified in the ``config/database.php``
8794
file.
8895

89-
To roll back the migration, run the following PHP artisan command:
96+
To roll back the migration, run the following PHP artisan command after
97+
replacing the placeholder:
9098

9199
.. code-block:: bash
92100

@@ -113,6 +121,7 @@ named ``telescopes`` exists:
113121

114122
.. literalinclude:: /includes/schema-builder/stars_migration.php
115123
:language: php
124+
:dedent:
116125
:start-after: begin conditional create
117126
:end-before: end conditional create
118127

@@ -372,6 +381,7 @@ from the ``flights`` collection:
372381

373382
.. literalinclude:: /includes/schema-builder/flights_migration.php
374383
:language: php
384+
:dedent:
375385
:start-after: begin drop index
376386
:end-before: end drop index
377387

docs/includes/schema-builder/astronauts_migration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
public function up(): void
1616
{
17-
Schema::create('astronauts', function ($collection) {
17+
Schema::create('astronauts', function (Blueprint $collection) {
1818
$collection->index('name');
1919
});
2020
}

0 commit comments

Comments
 (0)