diff --git a/3.0/docs/leaf/basics.md b/3.0/docs/leaf/basics.md index 55ff3816..ca985e71 100644 --- a/3.0/docs/leaf/basics.md +++ b/3.0/docs/leaf/basics.md @@ -155,6 +155,13 @@ Leaf provides some extra variables inside a `#for` loop to give you more informa - The `loop.isLast` variable is true when it's the last iteration. - The `loop.index` variable will be set to the number of the current iteration, counting from 0. +Here's how we could use a loop variable to print just the first name in our array: + +``` +#for(name in team) { + #if(isFirst) {

#(name) is first!

} +} +``` ### Embedding templates diff --git a/3.0/docs/postgresql/fluent.md b/3.0/docs/postgresql/fluent.md index 96778bd8..d2510bc6 100644 --- a/3.0/docs/postgresql/fluent.md +++ b/3.0/docs/postgresql/fluent.md @@ -44,6 +44,9 @@ vapor xcode Now let's create our first `PostgreSQLModel`. Models represent tables in your PostgreSQL database and they are the primary method of interacting with your data. ```swift +import FluentPostgreSQL +import Vapor + /// A simple user. final class User: PostgreSQLModel { /// The unique identifier for this user. @@ -166,4 +169,4 @@ router.get("psql-version") { req -> Future in In the above example, `withPooledConnection(to:)` is used to create a connection to the database identified by `.psql`. This is the default database identifier. See [Fluent → Database](../fluent/database.md#identifier) to learn more. -Once we have the `PostgreSQLConnection`, we can perform a query on it. You can learn more about the methods available in [PostgreSQL → Core](core.md). \ No newline at end of file +Once we have the `PostgreSQLConnection`, we can perform a query on it. You can learn more about the methods available in [PostgreSQL → Core](core.md).