You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/guides/api/database-setup.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@ Creating the Database and Model
7
7
:local:
8
8
:depth: 2
9
9
10
-
In this section, we set up the data layer by creating a SQLite database table for our ``books`` resource, seeding it with sample data, and defining a model to access it. By the end, you'll have a working ``book`` table populated with example rows.
10
+
In this section, we set up the data layer by creating a SQLite database table for our ``books`` resource, seeding it with sample data, and defining a model to access it. By the end, you'll have a working ``books`` table populated with example rows.
11
11
12
12
Create the Migrations
13
13
=====================
14
14
15
-
Migrations let you version-control your database schema by defining what to apply and how to roll it back. Let's make ones for simple ``author`` and ``book`` tables.
15
+
Migrations let you version-control your database schema by defining what to apply and how to roll it back. Let's make ones for simple ``authors`` and ``books`` tables.
16
16
17
17
Run the Spark command:
18
18
@@ -33,7 +33,7 @@ Now, edit **app/Database/Migrations/CreateBooksTable.php** to look like this:
33
33
34
34
.. literalinclude:: code/005.php
35
35
36
-
This contains a foreign key reference to the ``author`` table. It lets us associate each book with an author and keep author names in one place.
36
+
This contains a foreign key reference to the ``authors`` table. It lets us associate each book with an author and keep author names in one place.
37
37
38
38
Now run the migration:
39
39
@@ -58,7 +58,7 @@ Edit the file at **app/Database/Seeds/BookSeeder.php**:
58
58
59
59
.. literalinclude:: code/006.php
60
60
61
-
This seeder first inserts authors into the ``author`` table, captures their IDs, and then uses those IDs to insert books into the ``book`` table.
61
+
This seeder first inserts authors into the ``authors`` table, captures their IDs, and then uses those IDs to insert books into the ``books`` table.
62
62
63
63
Then run the seeder:
64
64
@@ -71,7 +71,7 @@ You should see confirmation messages indicating the rows were inserted.
71
71
Create the Book model
72
72
=====================
73
73
74
-
Models make database access simple and reusable by providing an object-oriented interface to your tables and a fluent query API. Let's create models for the ``author`` and ``book`` tables.
74
+
Models make database access simple and reusable by providing an object-oriented interface to your tables and a fluent query API. Let's create models for the ``authors`` and ``books`` tables.
Copy file name to clipboardExpand all lines: user_guide_src/source/guides/api/first-endpoint.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,4 +115,4 @@ The ``respond()`` method can return additional data:
115
115
116
116
.. literalinclude:: code/003.php
117
117
118
-
You now have a working endpoint tested in both the browser and cURL. In the next section, we'll create our first real database resource. You'll define a **migration**, **seeder**, and **model** for a simple ``book`` table that powers the API's CRUD endpoints.
118
+
You now have a working endpoint tested in both the browser and cURL. In the next section, we'll create our first real database resource. You'll define a **migration**, **seeder**, and **model** for a simple ``books`` table that powers the API's CRUD endpoints.
0 commit comments