From e73c40f0dea4db1205c83584d6c5b544b5ff1683 Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Tue, 23 Jan 2018 17:48:13 +0000 Subject: [PATCH] Don't say simply --- artisan.md | 4 ++-- authentication.md | 4 ++-- billing.md | 14 +++++++------- blade.md | 2 +- cache.md | 2 +- collections.md | 2 +- configuration.md | 2 +- container.md | 2 +- controllers.md | 4 ++-- database-testing.md | 2 +- dusk.md | 6 +++--- eloquent-mutators.md | 2 +- eloquent-relationships.md | 10 +++++----- eloquent-resources.md | 8 ++++---- eloquent.md | 8 ++++---- errors.md | 2 +- events.md | 8 ++++---- facades.md | 2 +- filesystem.md | 4 ++-- frontend.md | 4 ++-- helpers.md | 8 ++++---- homestead.md | 8 ++++---- lifecycle.md | 2 +- localization.md | 6 +++--- mail.md | 2 +- middleware.md | 8 ++++---- migrations.md | 8 ++++---- mix.md | 2 +- mocking.md | 2 +- notifications.md | 4 ++-- packages.md | 2 +- pagination.md | 4 ++-- passwords.md | 2 +- providers.md | 2 +- queries.md | 4 ++-- queues.md | 2 +- redirects.md | 2 +- redis.md | 4 ++-- releases.md | 2 +- responses.md | 4 ++-- routing.md | 2 +- scout.md | 2 +- seeding.md | 2 +- session.md | 2 +- structure.md | 2 +- testing.md | 4 ++-- validation.md | 6 +++--- 47 files changed, 95 insertions(+), 95 deletions(-) diff --git a/artisan.md b/artisan.md index f6ae69590..c8749f1eb 100644 --- a/artisan.md +++ b/artisan.md @@ -25,7 +25,7 @@ Artisan is the command-line interface included with Laravel. It provides a numbe php artisan list -Every command also includes a "help" screen which displays and describes the command's available arguments and options. To view a help screen, simply precede the name of the command with `help`: +Every command also includes a "help" screen which displays and describes the command's available arguments and options. To view a help screen, precede the name of the command with `help`: php artisan help migrate @@ -431,7 +431,7 @@ You may also specify the connection or queue the Artisan command should be dispa #### Passing Array Values -If your command defines an option that accepts an array, you may simply pass an array of values to that option: +If your command defines an option that accepts an array, you may pass an array of values to that option: Route::get('/foo', function () { $exitCode = Artisan::call('email:send', [ diff --git a/authentication.md b/authentication.md index c915b2fe5..33e511d86 100644 --- a/authentication.md +++ b/authentication.md @@ -67,7 +67,7 @@ The `make:auth` command will also create a `resources/views/layouts` directory c ### Authenticating -Now that you have routes and views setup for the included authentication controllers, you are ready to register and authenticate new users for your application! You may simply access your application in a browser since the authentication controllers already contain the logic (via their traits) to authenticate existing users and store new users in the database. +Now that you have routes and views setup for the included authentication controllers, you are ready to register and authenticate new users for your application! You may access your application in a browser since the authentication controllers already contain the logic (via their traits) to authenticate existing users and store new users in the database. #### Path Customization @@ -285,7 +285,7 @@ Of course, you may specify the guard instance you would like to use: #### Authenticate A User By ID -To log a user into the application by their ID, you may use the `loginUsingId` method. This method simply accepts the primary key of the user you wish to authenticate: +To log a user into the application by their ID, you may use the `loginUsingId` method. This method accepts the primary key of the user you wish to authenticate: Auth::loginUsingId(1); diff --git a/billing.md b/billing.md index 426c3b3ab..8addfd3c8 100644 --- a/billing.md +++ b/billing.md @@ -121,7 +121,7 @@ Next, register the `Laravel\Cashier\CashierServiceProvider` [service provider](/ Before using Cashier with Braintree, you will need to define a `plan-credit` discount in your Braintree control panel. This discount will be used to properly prorate subscriptions that change from yearly to monthly billing, or from monthly to yearly billing. -The discount amount configured in the Braintree control panel can be any value you wish, as Cashier will simply override the defined amount with our own custom amount each time we apply the coupon. This coupon is needed since Braintree does not natively support prorating subscriptions across subscription frequencies. +The discount amount configured in the Braintree control panel can be any value you wish, as Cashier will override the defined amount with our own custom amount each time we apply the coupon. This coupon is needed since Braintree does not natively support prorating subscriptions across subscription frequencies. #### Database Migrations @@ -147,7 +147,7 @@ Before using Cashier, we'll need to [prepare the database](/docs/{{version}}/mig $table->timestamps(); }); -Once the migrations have been created, simply run the `migrate` Artisan command. +Once the migrations have been created, run the `migrate` Artisan command. #### Billable Model @@ -331,7 +331,7 @@ The `taxPercentage` method enables you to apply a tax rate on a model-by-model b ### Cancelling Subscriptions -To cancel a subscription, simply call the `cancel` method on the user's subscription: +To cancel a subscription, call the `cancel` method on the user's subscription: $user->subscription('main')->cancel(); @@ -354,7 +354,7 @@ If a user has cancelled their subscription and you wish to resume it, use the `r $user->subscription('main')->resume(); -If the user cancels a subscription and then resumes that subscription before the subscription has fully expired, they will not be billed immediately. Instead, their subscription will simply be re-activated, and they will be billed on the original billing cycle. +If the user cancels a subscription and then resumes that subscription before the subscription has fully expired, they will not be billed immediately. Instead, their subscription will be re-activated, and they will be billed on the original billing cycle. ### Updating Credit Cards @@ -394,7 +394,7 @@ You may determine if the user is within their trial period using either the `onT ### Without Credit Card Up Front -If you would like to offer trial periods without collecting the user's payment method information up front, you may simply set the `trial_ends_at` column on the user record to your desired trial ending date. This is typically done during user registration: +If you would like to offer trial periods without collecting the user's payment method information up front, you may set the `trial_ends_at` column on the user record to your desired trial ending date. This is typically done during user registration: $user = User::create([ // Populate other user properties... @@ -446,7 +446,7 @@ Since Stripe webhooks need to bypass Laravel's [CSRF protection](/docs/{{version ### Defining Webhook Event Handlers -Cashier automatically handles subscription cancellation on failed charges, but if you have additional Stripe webhook events you would like to handle, simply extend the Webhook controller. Your method names should correspond to Cashier's expected convention, specifically, methods should be prefixed with `handle` and the "camel case" name of the Stripe webhook you wish to handle. For example, if you wish to handle the `invoice.payment_succeeded` webhook, you should add a `handleInvoicePaymentSucceeded` method to the controller: +Cashier automatically handles subscription cancellation on failed charges, but if you have additional Stripe webhook events you would like to handle, extend the Webhook controller. Your method names should correspond to Cashier's expected convention, specifically, methods should be prefixed with `handle` and the "camel case" name of the Stripe webhook you wish to handle. For example, if you wish to handle the `invoice.payment_succeeded` webhook, you should add a `handleInvoicePaymentSucceeded` method to the controller: ### Defining Webhook Event Handlers -Cashier automatically handles subscription cancellation on failed charges, but if you have additional Braintree webhook events you would like to handle, simply extend the Webhook controller. Your method names should correspond to Cashier's expected convention, specifically, methods should be prefixed with `handle` and the "camel case" name of the Braintree webhook you wish to handle. For example, if you wish to handle the `dispute_opened` webhook, you should add a `handleDisputeOpened` method to the controller: +Cashier automatically handles subscription cancellation on failed charges, but if you have additional Braintree webhook events you would like to handle, extend the Webhook controller. Your method names should correspond to Cashier's expected convention, specifically, methods should be prefixed with `handle` and the "camel case" name of the Braintree webhook you wish to handle. For example, if you wish to handle the `dispute_opened` webhook, you should add a `handleDisputeOpened` method to the controller: Whoops! Something went wrong! @endcomponent -Sometimes it is helpful to define multiple slots for a component. Let's modify our alert component to allow for the injection of a "title". Named slots may be displayed by simply "echoing" the variable that matches their name: +Sometimes it is helpful to define multiple slots for a component. Let's modify our alert component to allow for the injection of a "title". Named slots may be displayed by "echoing" the variable that matches their name: diff --git a/cache.md b/cache.md index 13de98715..5b64a8fd8 100644 --- a/cache.md +++ b/cache.md @@ -325,7 +325,7 @@ To register the custom cache driver with Laravel, we will use the `extend` metho The first argument passed to the `extend` method is the name of the driver. This will correspond to your `driver` option in the `config/cache.php` configuration file. The second argument is a Closure that should return an `Illuminate\Cache\Repository` instance. The Closure will be passed an `$app` instance, which is an instance of the [service container](/docs/{{version}}/container). -Once your extension is registered, simply update your `config/cache.php` configuration file's `driver` option to the name of your extension. +Once your extension is registered, update your `config/cache.php` configuration file's `driver` option to the name of your extension. ## Events diff --git a/collections.md b/collections.md index b96fd4744..9d302bdc4 100644 --- a/collections.md +++ b/collections.md @@ -823,7 +823,7 @@ The `implode` method joins the items in a collection. Its arguments depend on th // Desk, Chair -If the collection contains simple strings or numeric values, simply pass the "glue" as the only argument to the method: +If the collection contains simple strings or numeric values, pass the "glue" as the only argument to the method: collect([1, 2, 3, 4, 5])->implode('-'); diff --git a/configuration.md b/configuration.md index 2d4fdcf34..90c43766c 100644 --- a/configuration.md +++ b/configuration.md @@ -79,7 +79,7 @@ You should typically run the `php artisan config:cache` command as part of your When your application is in maintenance mode, a custom view will be displayed for all requests into your application. This makes it easy to "disable" your application while it is updating or when you are performing maintenance. A maintenance mode check is included in the default middleware stack for your application. If the application is in maintenance mode, a `MaintenanceModeException` will be thrown with a status code of 503. -To enable maintenance mode, simply execute the `down` Artisan command: +To enable maintenance mode, execute the `down` Artisan command: php artisan down diff --git a/container.md b/container.md index 365911c29..8387193a9 100644 --- a/container.md +++ b/container.md @@ -198,7 +198,7 @@ If some of your class' dependencies are not resolvable via the container, you ma #### Automatic Injection -Alternatively, and importantly, you may simply "type-hint" the dependency in the constructor of a class that is resolved by the container, including [controllers](/docs/{{version}}/controllers), [event listeners](/docs/{{version}}/events), [queue jobs](/docs/{{version}}/queues), [middleware](/docs/{{version}}/middleware), and more. In practice, this is how most of your objects should be resolved by the container. +Alternatively, and importantly, you may "type-hint" the dependency in the constructor of a class that is resolved by the container, including [controllers](/docs/{{version}}/controllers), [event listeners](/docs/{{version}}/events), [queue jobs](/docs/{{version}}/queues), [middleware](/docs/{{version}}/middleware), and more. In practice, this is how most of your objects should be resolved by the container. For example, you may type-hint a repository defined by your application in a controller's constructor. The repository will automatically be resolved and injected into the class: diff --git a/controllers.md b/controllers.md index 41aed135a..334360c53 100644 --- a/controllers.md +++ b/controllers.md @@ -62,7 +62,7 @@ Now, when a request matches the specified route URI, the `show` method on the `U It is very important to note that we did not need to specify the full controller namespace when defining the controller route. Since the `RouteServiceProvider` loads your route files within a route group that contains the namespace, we only specified the portion of the class name that comes after the `App\Http\Controllers` portion of the namespace. -If you choose to nest your controllers deeper into the `App\Http\Controllers` directory, simply use the specific class name relative to the `App\Http\Controllers` root namespace. So, if your full controller class is `App\Http\Controllers\Photos\AdminController`, you should register routes to the controller like so: +If you choose to nest your controllers deeper into the `App\Http\Controllers` directory, use the specific class name relative to the `App\Http\Controllers` root namespace. So, if your full controller class is `App\Http\Controllers\Photos\AdminController`, you should register routes to the controller like so: Route::get('foo', 'Photos\AdminController@method'); @@ -323,7 +323,7 @@ In addition to constructor injection, you may also type-hint dependencies on you } } -If your controller method is also expecting input from a route parameter, simply list your route arguments after your other dependencies. For example, if your route is defined like so: +If your controller method is also expecting input from a route parameter, list your route arguments after your other dependencies. For example, if your route is defined like so: Route::put('user/{id}', 'UserController@update'); diff --git a/database-testing.md b/database-testing.md index 21279ca88..ce9cc330a 100644 --- a/database-testing.md +++ b/database-testing.md @@ -45,7 +45,7 @@ The `--model` option may be used to indicate the name of the model created by th ## Resetting The Database After Each Test -It is often useful to reset your database after each test so that data from a previous test does not interfere with subsequent tests. The `RefreshDatabase` trait takes the most optimal approach to migrating your test database depending on if you are using an in-memory database or a traditional database. Simply use the trait on your test class and everything will be handled for you: +It is often useful to reset your database after each test so that data from a previous test does not interfere with subsequent tests. The `RefreshDatabase` trait takes the most optimal approach to migrating your test database depending on if you are using an in-memory database or a traditional database. Use the trait on your test class and everything will be handled for you: browse(function ($first, $second) { $first->loginAs(User::find(1)) @@ -922,7 +922,7 @@ If you are using CircleCI 1.0 to run your Dusk tests, you may use this configura ### Codeship -To run Dusk tests on [Codeship](https://codeship.com), add the following commands to your Codeship project. Of course, these commands are simply a starting point and you are free to add additional commands as needed: +To run Dusk tests on [Codeship](https://codeship.com), add the following commands to your Codeship project. Of course, these commands are a starting point and you are free to add additional commands as needed: phpenv local 7.1 cp .env.testing .env diff --git a/eloquent-mutators.md b/eloquent-mutators.md index 0de38ca3b..070f6a833 100644 --- a/eloquent-mutators.md +++ b/eloquent-mutators.md @@ -43,7 +43,7 @@ To define an accessor, create a `getFooAttribute` method on your model where `Fo } } -As you can see, the original value of the column is passed to the accessor, allowing you to manipulate and return the value. To access the value of the accessor, you may simply access the `first_name` attribute on a model instance: +As you can see, the original value of the column is passed to the accessor, allowing you to manipulate and return the value. To access the value of the accessor, you may access the `first_name` attribute on a model instance: $user = App\User::find(1); diff --git a/eloquent-relationships.md b/eloquent-relationships.md index 21055ba9c..7506943f3 100644 --- a/eloquent-relationships.md +++ b/eloquent-relationships.md @@ -291,7 +291,7 @@ In addition to customizing the name of the joining table, you may also customize #### Defining The Inverse Of The Relationship -To define the inverse of a many-to-many relationship, you simply place another call to `belongsToMany` on your related model. To continue our user roles example, let's define the `users` method on the `Role` model: +To define the inverse of a many-to-many relationship, you place another call to `belongsToMany` on your related model. To continue our user roles example, let's define the `users` method on the `Role` model: ### Relationship Methods Vs. Dynamic Properties -If you do not need to add additional constraints to an Eloquent relationship query, you may simply access the relationship as if it were a property. For example, continuing to use our `User` and `Post` example models, we may access all of a user's posts like so: +If you do not need to add additional constraints to an Eloquent relationship query, you may access the relationship as if it were a property. For example, continuing to use our `User` and `Post` example models, we may access all of a user's posts like so: $user = App\User::find(1); diff --git a/eloquent-resources.md b/eloquent-resources.md index 4ed3af40e..69ac91cfd 100644 --- a/eloquent-resources.md +++ b/eloquent-resources.md @@ -27,7 +27,7 @@ To generate a resource class, you may use the `make:resource` Artisan command. B In addition to generating resources that transform individual models, you may generate resources that are responsible for transforming collections of models. This allows your response to include links and other meta information that is relevant to an entire collection of a given resource. -To create a resource collection, you should use the `--collection` flag when creating the resource. Or, simply including the word `Collection` in the resource name will indicate to Laravel that it should create a collection resource. Collection resources extend the `Illuminate\Http\Resources\Json\ResourceCollection` class: +To create a resource collection, you should use the `--collection` flag when creating the resource. Or, including the word `Collection` in the resource name will indicate to Laravel that it should create a collection resource. Collection resources extend the `Illuminate\Http\Resources\Json\ResourceCollection` class: php artisan make:resource Users --collection @@ -170,7 +170,7 @@ Once a resource has been defined, it may be returned directly from a route or co #### Relationships -If you would like to include related resources in your response, you may simply add them to the array returned by your `toArray` method. In this example, we will use the `Post` resource's `collection` method to add the user's blog posts to the resource response: +If you would like to include related resources in your response, you may add them to the array returned by your `toArray` method. In this example, we will use the `Post` resource's `collection` method to add the user's blog posts to the resource response: /** * Transform the resource into an array. @@ -510,7 +510,7 @@ In addition to conditionally including relationship information in your resource ### Adding Meta Data -Some JSON API standards require the addition of meta data to your resource and resource collections responses. This often includes things like `links` to the resource or related resources, or meta data about the resource itself. If you need to return additional meta data about a resource, simply include it in your `toArray` method. For example, you might include `link` information when transforming a resource collection: +Some JSON API standards require the addition of meta data to your resource and resource collections responses. This often includes things like `links` to the resource or related resources, or meta data about the resource itself. If you need to return additional meta data about a resource, include it in your `toArray` method. For example, you might include `link` information when transforming a resource collection: /** * Transform the resource into an array. @@ -528,7 +528,7 @@ Some JSON API standards require the addition of meta data to your resource and r ]; } -When returning additional meta data from your resources, you never have to worry about accidentally overriding the `links` or `meta` keys that are automatically added by Laravel when returning paginated responses. Any additional `links` you define will simply be merged with the links provided by the paginator. +When returning additional meta data from your resources, you never have to worry about accidentally overriding the `links` or `meta` keys that are automatically added by Laravel when returning paginated responses. Any additional `links` you define will be merged with the links provided by the paginator. #### Top Level Meta Data diff --git a/eloquent.md b/eloquent.md index 0739ed0a7..5d4b6166a 100644 --- a/eloquent.md +++ b/eloquent.md @@ -189,7 +189,7 @@ For Eloquent methods like `all` and `get` which retrieve multiple results, an in return $flight->cancelled; }); -Of course, you may also simply loop over the collection like an array: +Of course, you may also loop over the collection like an array: foreach ($flights as $flight) { echo $flight->name; @@ -260,7 +260,7 @@ You may also use the `count`, `sum`, `max`, and other [aggregate methods](/docs/ ### Inserts -To create a new record in the database, simply create a new model instance, set attributes on the model, then call the `save` method: +To create a new record in the database, create a new model instance, set attributes on the model, then call the `save` method: ### Updates @@ -641,7 +641,7 @@ If you would like to remove several or even all of the global scopes, you may us ### Local Scopes -Local scopes allow you to define common sets of constraints that you may easily re-use throughout your application. For example, you may need to frequently retrieve all users that are considered "popular". To define a scope, simply prefix an Eloquent model method with `scope`. +Local scopes allow you to define common sets of constraints that you may easily re-use throughout your application. For example, you may need to frequently retrieve all users that are considered "popular". To define a scope, prefix an Eloquent model method with `scope`. Scopes should always return a query builder instance: diff --git a/errors.md b/errors.md index 20abf6c4f..8380c4c12 100644 --- a/errors.md +++ b/errors.md @@ -78,7 +78,7 @@ By default, Monolog is instantiated with name that matches the current environme ### The Report Method -All exceptions are handled by the `App\Exceptions\Handler` class. This class contains two methods: `report` and `render`. We'll examine each of these methods in detail. The `report` method is used to log exceptions or send them to an external service like [Bugsnag](https://bugsnag.com) or [Sentry](https://github.com/getsentry/sentry-laravel). By default, the `report` method simply passes the exception to the base class where the exception is logged. However, you are free to log exceptions however you wish. +All exceptions are handled by the `App\Exceptions\Handler` class. This class contains two methods: `report` and `render`. We'll examine each of these methods in detail. The `report` method is used to log exceptions or send them to an external service like [Bugsnag](https://bugsnag.com) or [Sentry](https://github.com/getsentry/sentry-laravel). By default, the `report` method passes the exception to the base class where the exception is logged. However, you are free to log exceptions however you wish. For example, if you need to report different types of exceptions in different ways, you may use the PHP `instanceof` comparison operator: diff --git a/events.md b/events.md index f588cf252..ae97b2275 100644 --- a/events.md +++ b/events.md @@ -19,7 +19,7 @@ Laravel's events provides a simple observer implementation, allowing you to subscribe and listen for various events that occur in your application. Event classes are typically stored in the `app/Events` directory, while their listeners are stored in `app/Listeners`. Don't worry if you don't see these directories in your application, since they will be created for you as you generate events and listeners using Artisan console commands. -Events serve as a great way to decouple various aspects of your application, since a single event can have multiple listeners that do not depend on each other. For example, you may wish to send a Slack notification to your user each time an order has shipped. Instead of coupling your order processing code to your Slack notification code, you can simply raise an `OrderShipped` event, which a listener can receive and transform into a Slack notification. +Events serve as a great way to decouple various aspects of your application, since a single event can have multiple listeners that do not depend on each other. For example, you may wish to send a Slack notification to your user each time an order has shipped. Instead of coupling your order processing code to your Slack notification code, you can raise an `OrderShipped` event, which a listener can receive and transform into a Slack notification. ## Registering Events & Listeners @@ -40,7 +40,7 @@ The `EventServiceProvider` included with your Laravel application provides a con ### Generating Events & Listeners -Of course, manually creating the files for each event and listener is cumbersome. Instead, simply add listeners and events to your `EventServiceProvider` and use the `event:generate` command. This command will generate any events or listeners that are listed in your `EventServiceProvider`. Of course, events and listeners that already exist will be left untouched: +Of course, manually creating the files for each event and listener is cumbersome. Instead, add listeners and events to your `EventServiceProvider` and use the `event:generate` command. This command will generate any events or listeners that are listed in your `EventServiceProvider`. Of course, events and listeners that already exist will be left untouched: php artisan event:generate @@ -74,7 +74,7 @@ You may even register listeners using the `*` as a wildcard parameter, allowing ## Defining Events -An event class is simply a data container which holds the information related to the event. For example, let's assume our generated `OrderShipped` event receives an [Eloquent ORM](/docs/{{version}}/eloquent) object: +An event class is a data container which holds the information related to the event. For example, let's assume our generated `OrderShipped` event receives an [Eloquent ORM](/docs/{{version}}/eloquent) object: ## Defining Listeners diff --git a/facades.md b/facades.md index 7e6e15114..6facec115 100644 --- a/facades.md +++ b/facades.md @@ -172,7 +172,7 @@ Using real-time facades, you may treat any class in your application as if it we } } -Injecting a publisher implementation into the method allows us to easily test the method in isolation since we can mock the injected publisher. However, it requires us to always pass a publisher instance each time we call the `publish` method. Using real-time facades, we can maintain the same testability while not being required to explicitly pass a `Publisher` instance. To generate a real-time facade, simply prefix the namespace of the imported class with `Facades`: +Injecting a publisher implementation into the method allows us to easily test the method in isolation since we can mock the injected publisher. However, it requires us to always pass a publisher instance each time we call the `publish` method. Using real-time facades, we can maintain the same testability while not being required to explicitly pass a `Publisher` instance. To generate a real-time facade, prefix the namespace of the imported class with `Facades`: ## Configuration -The filesystem configuration file is located at `config/filesystems.php`. Within this file you may configure all of your "disks". Each disk represents a particular storage driver and storage location. Example configurations for each supported driver are included in the configuration file. So, simply modify the configuration to reflect your storage preferences and credentials. +The filesystem configuration file is located at `config/filesystems.php`. Within this file you may configure all of your "disks". Each disk represents a particular storage driver and storage location. Example configurations for each supported driver are included in the configuration file. So, modify the configuration to reflect your storage preferences and credentials. Of course, you may configure as many disks as you like, and may even have multiple disks that use the same driver. @@ -210,7 +210,7 @@ The `copy` method may be used to copy an existing file to a new location on the ### File Uploads -In web applications, one of the most common use-cases for storing files is storing user uploaded files such as profile pictures, photos, and documents. Laravel makes it very easy to store uploaded files using the `store` method on an uploaded file instance. Simply call the `store` method with the path at which you wish to store the uploaded file: +In web applications, one of the most common use-cases for storing files is storing user uploaded files such as profile pictures, photos, and documents. Laravel makes it very easy to store uploaded files using the `store` method on an uploaded file instance. Call the `store` method with the path at which you wish to store the uploaded file: ## Writing CSS -Laravel's `package.json` file includes the `bootstrap-sass` package to help you get started prototyping your application's frontend using Bootstrap. However, feel free to add or remove packages from the `package.json` file as needed for your own application. You are not required to use the Bootstrap framework to build your Laravel application - it is simply provided as a good starting point for those who choose to use it. +Laravel's `package.json` file includes the `bootstrap-sass` package to help you get started prototyping your application's frontend using Bootstrap. However, feel free to add or remove packages from the `package.json` file as needed for your own application. You are not required to use the Bootstrap framework to build your Laravel application - it is provided as a good starting point for those who choose to use it. Before compiling your CSS, install your project's frontend dependencies using the [Node package manager (NPM)](https://www.npmjs.org): @@ -67,7 +67,7 @@ By default, fresh Laravel applications contain an `ExampleComponent.vue` Vue com require('./components/ExampleComponent.vue') ); -To use the component in your application, you may simply drop it into one of your HTML templates. For example, after running the `make:auth` Artisan command to scaffold your application's authentication and registration screens, you could drop the component into the `home.blade.php` Blade template: +To use the component in your application, you may drop it into one of your HTML templates. For example, after running the `make:auth` Artisan command to scaffold your application's authentication and registration screens, you could drop the component into the `home.blade.php` Blade template: @extends('layouts.app') diff --git a/helpers.md b/helpers.md index ca1c5ea38..98c275890 100644 --- a/helpers.md +++ b/helpers.md @@ -704,7 +704,7 @@ The `__` function translates the given translation string or translation key usi echo __('messages.welcome'); -If the specified translation string or key does not exist, the `__` function will simply return the given value. So, using the example above, the `__` function would return `messages.welcome` if that translation key does not exist. +If the specified translation string or key does not exist, the `__` function will return the given value. So, using the example above, the `__` function would return `messages.welcome` if that translation key does not exist. #### `camel_case()` {#collection-method} @@ -973,7 +973,7 @@ The `trans` function translates the given translation key using your [localizati echo trans('messages.welcome'); -If the specified translation key does not exist, the `trans` function will simply return the given key. So, using the example above, the `trans` function would return `messages.welcome` if the translation key does not exist. +If the specified translation key does not exist, the `trans` function will return the given key. So, using the example above, the `trans` function would return `messages.welcome` if the translation key does not exist. #### `trans_choice()` {#collection-method} @@ -982,7 +982,7 @@ The `trans_choice` function translates the given translation key with inflection echo trans_choice('messages.notifications', $unreadCount); -If the specified translation key does not exist, the `trans_choice` function will simply return the given key. So, using the example above, the `trans_choice` function would return `messages.notifications` if the translation key does not exist. +If the specified translation key does not exist, the `trans_choice` function will return the given key. So, using the example above, the `trans_choice` function would return `messages.notifications` if the translation key does not exist. ## URLs @@ -1363,7 +1363,7 @@ The `old` function [retrieves](/docs/{{version}}/requests#retrieving-input) an [ #### `optional()` {#collection-method} -The `optional` function accepts any argument and allows you to access properties or call methods on that object. If the given object is `null`, properties and methods will simply return `null` instead of causing an error: +The `optional` function accepts any argument and allows you to access properties or call methods on that object. If the given object is `null`, properties and methods will return `null` instead of causing an error: return optional($user->address)->street; diff --git a/homestead.md b/homestead.md index da07df462..16d120b8d 100644 --- a/homestead.md +++ b/homestead.md @@ -87,7 +87,7 @@ If this command fails, make sure your Vagrant installation is up to date. #### Installing Homestead -You may install Homestead by simply cloning the repository. Consider cloning the repository into a `Homestead` folder within your "home" directory, as the Homestead box will serve as the host to all of your Laravel projects: +You may install Homestead by cloning the repository. Consider cloning the repository into a `Homestead` folder within your "home" directory, as the Homestead box will serve as the host to all of your Laravel projects: git clone https://github.com/laravel/homestead.git ~/Homestead @@ -181,7 +181,7 @@ To destroy the machine, you may use the `vagrant destroy --force` command. ### Per Project Installation -Instead of installing Homestead globally and sharing the same Homestead box across all of your projects, you may instead configure a Homestead instance for each project you manage. Installing Homestead per project may be beneficial if you wish to ship a `Vagrantfile` with your project, allowing others working on the project to simply `vagrant up`. +Instead of installing Homestead globally and sharing the same Homestead box across all of your projects, you may instead configure a Homestead instance for each project you manage. Installing Homestead per project may be beneficial if you wish to ship a `Vagrantfile` with your project, allowing others working on the project to `vagrant up`. To install Homestead directly into your project, require it using Composer: @@ -287,7 +287,7 @@ To connect to your MySQL or PostgreSQL database from your host machine's databas ### Adding Additional Sites -Once your Homestead environment is provisioned and running, you may want to add additional Nginx sites for your Laravel applications. You can run as many Laravel installations as you wish on a single Homestead environment. To add an additional site, simply add the site to your `Homestead.yaml` file: +Once your Homestead environment is provisioned and running, you may want to add additional Nginx sites for your Laravel applications. You can run as many Laravel installations as you wish on a single Homestead environment. To add an additional site, add the site to your `Homestead.yaml` file: sites: - map: homestead.test @@ -459,7 +459,7 @@ You can update Homestead in two simple steps. First, you should update the Vagra vagrant box update -Next, you need to update the Homestead source code. If you cloned the repository you can simply `git pull origin master` at the location you originally cloned the repository. +Next, you need to update the Homestead source code. If you cloned the repository you can `git pull origin master` at the location you originally cloned the repository. If you have installed Homestead via your project's `composer.json` file, you should ensure your `composer.json` file contains `"laravel/homestead": "^7"` and update your dependencies: diff --git a/lifecycle.md b/lifecycle.md index 27e0da937..413bd2dbe 100644 --- a/lifecycle.md +++ b/lifecycle.md @@ -16,7 +16,7 @@ The goal of this document is to give you a good, high-level overview of how the ### First Things -The entry point for all requests to a Laravel application is the `public/index.php` file. All requests are directed to this file by your web server (Apache / Nginx) configuration. The `index.php` file doesn't contain much code. Rather, it is simply a starting point for loading the rest of the framework. +The entry point for all requests to a Laravel application is the `public/index.php` file. All requests are directed to this file by your web server (Apache / Nginx) configuration. The `index.php` file doesn't contain much code. Rather, it is a starting point for loading the rest of the framework. The `index.php` file loads the Composer generated autoloader definition, and then retrieves an instance of the Laravel application from `bootstrap/app.php` script. The first action taken by Laravel itself is to create an instance of the application / [service container](/docs/{{version}}/container). diff --git a/localization.md b/localization.md index 86ce30323..d8273858d 100644 --- a/localization.md +++ b/localization.md @@ -21,7 +21,7 @@ Laravel's localization features provide a convenient way to retrieve strings in /es messages.php -All language files simply return an array of keyed strings. For example: +All language files return an array of keyed strings. For example: ### Replacing Parameters In Translation Strings diff --git a/mail.md b/mail.md index 8932539bf..25a505c97 100644 --- a/mail.md +++ b/mail.md @@ -417,7 +417,7 @@ This command will publish the Markdown mail components to the `resources/views/v After exporting the components, the `resources/views/vendor/mail/html/themes` directory will contain a `default.css` file. You may customize the CSS in this file and your styles will automatically be in-lined within the HTML representations of your Markdown mail messages. -> {tip} If you would like to build an entirely new theme for the Markdown components, simply write a new CSS file within the `html/themes` directory and change the `theme` option of your `mail` configuration file. +> {tip} If you would like to build an entirely new theme for the Markdown components, write a new CSS file within the `html/themes` directory and change the `theme` option of your `mail` configuration file. ## Previewing Mailables In The Browser diff --git a/middleware.md b/middleware.md index e458d17a4..97d832d84 100644 --- a/middleware.md +++ b/middleware.md @@ -52,7 +52,7 @@ This command will place a new `CheckAge` class within your `app/Http/Middleware` } } -As you can see, if the given `age` is less than or equal to `200`, the middleware will return an HTTP redirect to the client; otherwise, the request will be passed further into the application. To pass the request deeper into the application (allowing the middleware to "pass"), simply call the `$next` callback with the `$request`. +As you can see, if the given `age` is less than or equal to `200`, the middleware will return an HTTP redirect to the client; otherwise, the request will be passed further into the application. To pass the request deeper into the application (allowing the middleware to "pass"), call the `$next` callback with the `$request`. It's best to envision middleware as a series of "layers" HTTP requests must pass through before they hit your application. Each layer can examine the request and even reject it entirely. @@ -102,12 +102,12 @@ However, this middleware would perform its task **after** the request is handled ### Global Middleware -If you want a middleware to run during every HTTP request to your application, simply list the middleware class in the `$middleware` property of your `app/Http/Kernel.php` class. +If you want a middleware to run during every HTTP request to your application, list the middleware class in the `$middleware` property of your `app/Http/Kernel.php` class. ### Assigning Middleware To Routes -If you would like to assign middleware to specific routes, you should first assign the middleware a key in your `app/Http/Kernel.php` file. By default, the `$routeMiddleware` property of this class contains entries for the middleware included with Laravel. To add your own, simply append it to this list and assign it a key of your choosing. For example: +If you would like to assign middleware to specific routes, you should first assign the middleware a key in your `app/Http/Kernel.php` file. By default, the `$routeMiddleware` property of this class contains entries for the middleware included with Laravel. To add your own, append it to this list and assign it a key of your choosing. For example: // Within App\Http\Kernel Class... @@ -168,7 +168,7 @@ Out of the box, Laravel comes with `web` and `api` middleware groups that contai ], ]; -Middleware groups may be assigned to routes and controller actions using the same syntax as individual middleware. Again, middleware groups simply make it more convenient to assign many middleware to a route at once: +Middleware groups may be assigned to routes and controller actions using the same syntax as individual middleware. Again, middleware groups make it more convenient to assign many middleware to a route at once: Route::get('/', function () { // diff --git a/migrations.md b/migrations.md index bb258a6a2..99db34d6e 100644 --- a/migrations.md +++ b/migrations.md @@ -34,7 +34,7 @@ To create a migration, use the `make:migration` [Artisan command](/docs/{{versio The new migration will be placed in your `database/migrations` directory. Each migration file name contains a timestamp which allows Laravel to determine the order of the migrations. -The `--table` and `--create` options may also be used to indicate the name of the table and whether the migration will be creating a new table. These options simply pre-fill the generated migration stub file with the specified table: +The `--table` and `--create` options may also be used to indicate the name of the table and whether the migration will be creating a new table. These options pre-fill the generated migration stub file with the specified table: php artisan make:migration create_users_table --create=users @@ -45,7 +45,7 @@ If you would like to specify a custom output path for the generated migration, y ## Migration Structure -A migration class contains two methods: `up` and `down`. The `up` method is used to add new tables, columns, or indexes to your database, while the `down` method should simply reverse the operations performed by the `up` method. +A migration class contains two methods: `up` and `down`. The `up` method is used to add new tables, columns, or indexes to your database, while the `down` method should reverse the operations performed by the `up` method. Within both of these methods you may use the Laravel schema builder to expressively create and modify tables. To learn about all of the methods available on the `Schema` builder, [check out its documentation](#creating-tables). For example, this migration example creates a `flights` table: @@ -363,7 +363,7 @@ Command | Description ### Creating Indexes -The schema builder supports several types of indexes. First, let's look at an example that specifies a column's values should be unique. To create the index, we can simply chain the `unique` method onto the column definition: +The schema builder supports several types of indexes. First, let's look at an example that specifies a column's values should be unique. To create the index, we can chain the `unique` method onto the column definition: $table->string('email')->unique(); @@ -410,7 +410,7 @@ Alternatively, you may enable the `innodb_large_prefix` option for your database ### Dropping Indexes -To drop an index, you must specify the index's name. By default, Laravel automatically assigns a reasonable name to the indexes. Simply concatenate the table name, the name of the indexed column, and the index type. Here are some examples: +To drop an index, you must specify the index's name. By default, Laravel automatically assigns a reasonable name to the indexes. Concatenate the table name, the name of the indexed column, and the index type. Here are some examples: Command | Description ------- | ----------- diff --git a/mix.md b/mix.md index 656502de5..67f9aa81c 100644 --- a/mix.md +++ b/mix.md @@ -194,7 +194,7 @@ Though disabled by default, source maps may be activated by calling the `mix.sou ## Working With JavaScript -Mix provides several features to help you work with your JavaScript files, such as compiling ECMAScript 2015, module bundling, minification, and simply concatenating plain JavaScript files. Even better, this all works seamlessly, without requiring an ounce of custom configuration: +Mix provides several features to help you work with your JavaScript files, such as compiling ECMAScript 2015, module bundling, minification, and concatenating plain JavaScript files. Even better, this all works seamlessly, without requiring an ounce of custom configuration: mix.js('resources/assets/js/app.js', 'public/js'); diff --git a/mocking.md b/mocking.md index 263d8dbff..ba5873fb0 100644 --- a/mocking.md +++ b/mocking.md @@ -298,4 +298,4 @@ We can mock the call to the `Cache` facade by using the `shouldReceive` method, } } -> {note} You should not mock the `Request` facade. Instead, pass the input you desire into the HTTP helper methods such as `get` and `post` when running your test. Likewise, instead of mocking the `Config` facade, simply call the `Config::set` method in your tests. +> {note} You should not mock the `Request` facade. Instead, pass the input you desire into the HTTP helper methods such as `get` and `post` when running your test. Likewise, instead of mocking the `Config` facade, call the `Config::set` method in your tests. diff --git a/notifications.md b/notifications.md index a571f5b38..69a90883b 100644 --- a/notifications.md +++ b/notifications.md @@ -374,7 +374,7 @@ This command will publish the Markdown mail components to the `resources/views/v After exporting the components, the `resources/views/vendor/mail/html/themes` directory will contain a `default.css` file. You may customize the CSS in this file and your styles will automatically be in-lined within the HTML representations of your Markdown notifications. -> {tip} If you would like to build an entirely new theme for the Markdown components, simply write a new CSS file within the `html/themes` directory and change the `theme` option of your `mail` configuration file. +> {tip} If you would like to build an entirely new theme for the Markdown components, write a new CSS file within the `html/themes` directory and change the `theme` option of your `mail` configuration file. ## Database Notifications @@ -867,7 +867,7 @@ Laravel ships with a handful of notification channels, but you may want to write } } -Once your notification channel class has been defined, you may simply return the class name from the `via` method of any of your notifications: +Once your notification channel class has been defined, you may return the class name from the `via` method of any of your notifications: ### Converting Results To JSON -The Laravel paginator result classes implement the `Illuminate\Contracts\Support\Jsonable` Interface contract and expose the `toJson` method, so it's very easy to convert your pagination results to JSON. You may also convert a paginator instance to JSON by simply returning it from a route or controller action: +The Laravel paginator result classes implement the `Illuminate\Contracts\Support\Jsonable` Interface contract and expose the `toJson` method, so it's very easy to convert your pagination results to JSON. You may also convert a paginator instance to JSON by returning it from a route or controller action: Route::get('users', function () { return App\User::paginate(); @@ -165,7 +165,7 @@ However, the easiest way to customize the pagination views is by exporting them php artisan vendor:publish --tag=laravel-pagination -This command will place the views in the `resources/views/vendor/pagination` directory. The `default.blade.php` file within this directory corresponds to the default pagination view. Simply edit this file to modify the pagination HTML. +This command will place the views in the `resources/views/vendor/pagination` directory. The `default.blade.php` file within this directory corresponds to the default pagination view. Edit this file to modify the pagination HTML. ## Paginator Instance Methods diff --git a/passwords.md b/passwords.md index 0a8beeed9..a03157c21 100644 --- a/passwords.md +++ b/passwords.md @@ -42,7 +42,7 @@ Again, Laravel will generate all of the necessary views for password reset when ## After Resetting Passwords -Once you have defined the routes and views to reset your user's passwords, you may simply access the route in your browser at `/password/reset`. The `ForgotPasswordController` included with the framework already includes the logic to send the password reset link e-mails, while the `ResetPasswordController` includes the logic to reset user passwords. +Once you have defined the routes and views to reset your user's passwords, you may access the route in your browser at `/password/reset`. The `ForgotPasswordController` included with the framework already includes the logic to send the password reset link e-mails, while the `ResetPasswordController` includes the logic to reset user passwords. After a password is reset, the user will automatically be logged into the application and redirected to `/home`. You can customize the post password reset redirect location by defining a `redirectTo` property on the `ResetPasswordController`: diff --git a/providers.md b/providers.md index 1f59fa083..b1e9392fd 100644 --- a/providers.md +++ b/providers.md @@ -102,7 +102,7 @@ You may type-hint dependencies for your service provider's `boot` method. The [s All service providers are registered in the `config/app.php` configuration file. This file contains a `providers` array where you can list the class names of your service providers. By default, a set of Laravel core service providers are listed in this array. These providers bootstrap the core Laravel components, such as the mailer, queue, cache, and others. -To register your provider, simply add it to the array: +To register your provider, add it to the array: 'providers' => [ // Other Service Providers diff --git a/queries.md b/queries.md index 99f9490e9..952663517 100644 --- a/queries.md +++ b/queries.md @@ -272,7 +272,7 @@ For example, here is a query that verifies the value of the "votes" column is eq $users = DB::table('users')->where('votes', '=', 100)->get(); -For convenience, if you simply want to verify that a column is equal to a given value, you may pass the value directly as the second argument to the `where` method: +For convenience, if you want to verify that a column is equal to a given value, you may pass the value directly as the second argument to the `where` method: $users = DB::table('users')->where('votes', 100)->get(); @@ -587,7 +587,7 @@ When updating a JSON column, you should use `->` syntax to access the appropriat ### Increment & Decrement -The query builder also provides convenient methods for incrementing or decrementing the value of a given column. This is simply a shortcut, providing a more expressive and terse interface compared to manually writing the `update` statement. +The query builder also provides convenient methods for incrementing or decrementing the value of a given column. This is a shortcut, providing a more expressive and terse interface compared to manually writing the `update` statement. Both of these methods accept at least one argument: the column to modify. A second argument may optionally be passed to control the amount by which the column should be incremented or decremented: diff --git a/queues.md b/queues.md index 2a65f8083..4e77c2305 100644 --- a/queues.md +++ b/queues.md @@ -31,7 +31,7 @@ Laravel queues provide a unified API across a variety of different queue backends, such as Beanstalk, Amazon SQS, Redis, or even a relational database. Queues allow you to defer the processing of a time consuming task, such as sending an email, until a later time. Deferring these time consuming tasks drastically speeds up web requests to your application. -The queue configuration file is stored in `config/queue.php`. In this file you will find connection configurations for each of the queue drivers that are included with the framework, which includes a database, [Beanstalkd](https://kr.github.io/beanstalkd/), [Amazon SQS](https://aws.amazon.com/sqs/), [Redis](https://redis.io), and a synchronous driver that will execute jobs immediately (for local use). A `null` queue driver is also included which simply discards queued jobs. +The queue configuration file is stored in `config/queue.php`. In this file you will find connection configurations for each of the queue drivers that are included with the framework, which includes a database, [Beanstalkd](https://kr.github.io/beanstalkd/), [Amazon SQS](https://aws.amazon.com/sqs/), [Redis](https://redis.io), and a synchronous driver that will execute jobs immediately (for local use). A `null` queue driver is also included which discards queued jobs. ### Connections Vs. Queues diff --git a/redirects.md b/redirects.md index e31c97bbf..2c965c3a9 100644 --- a/redirects.md +++ b/redirects.md @@ -37,7 +37,7 @@ If your route has parameters, you may pass them as the second argument to the `r #### Populating Parameters Via Eloquent Models -If you are redirecting to a route with an "ID" parameter that is being populated from an Eloquent model, you may simply pass the model itself. The ID will be extracted automatically: +If you are redirecting to a route with an "ID" parameter that is being populated from an Eloquent model, you may pass the model itself. The ID will be extracted automatically: // For a route with the following URI: profile/{id} diff --git a/redis.md b/redis.md index d59baf8f1..59c1edd77 100644 --- a/redis.md +++ b/redis.md @@ -79,7 +79,7 @@ By default, clusters will perform client-side sharding across your nodes, allowi ### Predis -In addition to the default `host`, `port`, `database`, and `password` server configuration options, Predis supports additional [connection parameters](https://github.com/nrk/predis/wiki/Connection-Parameters) that may be defined for each of your Redis servers. To utilize these additional configuration options, simply add them to your Redis server configuration in the `config/database.php` configuration file: +In addition to the default `host`, `port`, `database`, and `password` server configuration options, Predis supports additional [connection parameters](https://github.com/nrk/predis/wiki/Connection-Parameters) that may be defined for each of your Redis servers. To utilize these additional configuration options, add them to your Redis server configuration in the `config/database.php` configuration file: 'default' => [ 'host' => env('REDIS_HOST', 'localhost'), @@ -141,7 +141,7 @@ You may interact with Redis by calling various methods on the `Redis` [facade](/ } } -Of course, as mentioned above, you may call any of the Redis commands on the `Redis` facade. Laravel uses magic methods to pass the commands to the Redis server, so simply pass the arguments the Redis command expects: +Of course, as mentioned above, you may call any of the Redis commands on the `Redis` facade. Laravel uses magic methods to pass the commands to the Redis server, so pass the arguments the Redis command expects: Redis::set('name', 'Taylor'); diff --git a/releases.md b/releases.md index 1f93e91c7..0fcba9b05 100644 --- a/releases.md +++ b/releases.md @@ -219,7 +219,7 @@ A rule object only has two methods: `passes` and `message`. The `passes` method } } -Once the rule has been defined, you may use it by simply passing an instance of the rule object with your other validation rules: +Once the rule has been defined, you may use it by passing an instance of the rule object with your other validation rules: use App\Rules\ValidName; diff --git a/responses.md b/responses.md index c7643fd9a..6a856428b 100644 --- a/responses.md +++ b/responses.md @@ -21,7 +21,7 @@ #### Strings & Arrays -All routes and controllers should return a response to be sent back to the user's browser. Laravel provides several different ways to return responses. The most basic response is simply returning a string from a route or controller. The framework will automatically convert the string into a full HTTP response: +All routes and controllers should return a response to be sent back to the user's browser. Laravel provides several different ways to return responses. The most basic response is returning a string from a route or controller. The framework will automatically convert the string into a full HTTP response: Route::get('/', function () { return 'Hello World'; @@ -130,7 +130,7 @@ If your route has parameters, you may pass them as the second argument to the `r #### Populating Parameters Via Eloquent Models -If you are redirecting to a route with an "ID" parameter that is being populated from an Eloquent model, you may simply pass the model itself. The ID will be extracted automatically: +If you are redirecting to a route with an "ID" parameter that is being populated from an Eloquent model, you may pass the model itself. The ID will be extracted automatically: // For a route with the following URI: profile/{id} diff --git a/routing.md b/routing.md index 9a46667bc..15c62f84d 100644 --- a/routing.md +++ b/routing.md @@ -23,7 +23,7 @@ ## Basic Routing -The most basic Laravel routes simply accept a URI and a `Closure`, providing a very simple and expressive method of defining routes: +The most basic Laravel routes accept a URI and a `Closure`, providing a very simple and expressive method of defining routes: Route::get('foo', function () { return 'Hello World'; diff --git a/scout.md b/scout.md index bfb0ad575..211ef8b1b 100644 --- a/scout.md +++ b/scout.md @@ -190,7 +190,7 @@ You may also use the `searchable` method on an Eloquent query to update a collec ### Removing Records -To remove a record from your index, simply `delete` the model from the database. This form of removal is even compatible with [soft deleted](/docs/{{version}}/eloquent#soft-deleting) models: +To remove a record from your index, `delete` the model from the database. This form of removal is even compatible with [soft deleted](/docs/{{version}}/eloquent#soft-deleting) models: $order = App\Order::find(1); diff --git a/seeding.md b/seeding.md index ee61a63b7..288f4ae06 100644 --- a/seeding.md +++ b/seeding.md @@ -68,7 +68,7 @@ For example, let's create 50 users and attach a relationship to each user: ### Calling Additional Seeders -Within the `DatabaseSeeder` class, you may use the `call` method to execute additional seed classes. Using the `call` method allows you to break up your database seeding into multiple files so that no single seeder class becomes overwhelmingly large. Simply pass the name of the seeder class you wish to run: +Within the `DatabaseSeeder` class, you may use the `call` method to execute additional seed classes. Using the `call` method allows you to break up your database seeding into multiple files so that no single seeder class becomes overwhelmingly large. Pass the name of the seeder class you wish to run: /** * Run the database seeds. diff --git a/session.md b/session.md index e3ad31496..7076a59a0 100644 --- a/session.md +++ b/session.md @@ -219,7 +219,7 @@ Your custom session driver should implement the `SessionHandlerInterface`. This Since the purpose of these methods is not readily understandable, let's quickly cover what each of the methods do:
-- The `open` method would typically be used in file based session store systems. Since Laravel ships with a `file` session driver, you will almost never need to put anything in this method. You can leave it as an empty stub. It is simply a fact of poor interface design (which we'll discuss later) that PHP requires us to implement this method. +- The `open` method would typically be used in file based session store systems. Since Laravel ships with a `file` session driver, you will almost never need to put anything in this method. You can leave it as an empty stub. It is a fact of poor interface design (which we'll discuss later) that PHP requires us to implement this method. - The `close` method, like the `open` method, can also usually be disregarded. For most drivers, it is not needed. - The `read` method should return the string version of the session data associated with the given `$sessionId`. There is no need to do any serialization or other encoding when retrieving or storing session data in your driver, as Laravel will perform the serialization for you. - The `write` method should write the given `$data` string associated with the `$sessionId` to some persistent storage system, such as MongoDB, Dynamo, etc. Again, you should not perform any serialization - Laravel will have already handled that for you. diff --git a/structure.md b/structure.md index e2d1f5331..93477f3af 100644 --- a/structure.md +++ b/structure.md @@ -104,7 +104,7 @@ The `vendor` directory contains your [Composer](https://getcomposer.org) depende The majority of your application is housed in the `app` directory. By default, this directory is namespaced under `App` and is autoloaded by Composer using the [PSR-4 autoloading standard](http://www.php-fig.org/psr/psr-4/). -The `app` directory contains a variety of additional directories such as `Console`, `Http`, and `Providers`. Think of the `Console` and `Http` directories as providing an API into the core of your application. The HTTP protocol and CLI are both mechanisms to interact with your application, but do not actually contain application logic. In other words, they are simply two ways of issuing commands to your application. The `Console` directory contains all of your Artisan commands, while the `Http` directory contains your controllers, middleware, and requests. +The `app` directory contains a variety of additional directories such as `Console`, `Http`, and `Providers`. Think of the `Console` and `Http` directories as providing an API into the core of your application. The HTTP protocol and CLI are both mechanisms to interact with your application, but do not actually contain application logic. In other words, they are two ways of issuing commands to your application. The `Console` directory contains all of your Artisan commands, while the `Http` directory contains your controllers, middleware, and requests. A variety of other directories will be generated inside the `app` directory as you use the `make` Artisan commands to generate classes. So, for example, the `app/Jobs` directory will not exist until you execute the `make:job` Artisan command to generate a job class. diff --git a/testing.md b/testing.md index 9d844fd94..fa8a736f1 100644 --- a/testing.md +++ b/testing.md @@ -11,7 +11,7 @@ Laravel is built with testing in mind. In fact, support for testing with PHPUnit By default, your application's `tests` directory contains two directories: `Feature` and `Unit`. Unit tests are tests that focus on a very small, isolated portion of your code. In fact, most unit tests probably focus on a single method. Feature tests may test a larger portion of your code, including how several objects interact with each other or even a full HTTP request to a JSON endpoint. -An `ExampleTest.php` file is provided in both the `Feature` and `Unit` test directories. After installing a new Laravel application, simply run `phpunit` on the command line to run your tests. +An `ExampleTest.php` file is provided in both the `Feature` and `Unit` test directories. After installing a new Laravel application, run `phpunit` on the command line to run your tests. ## Environment @@ -31,7 +31,7 @@ To create a new test case, use the `make:test` Artisan command: // Create a test in the Unit directory... php artisan make:test UserTest --unit -Once the test has been generated, you may define test methods as you normally would using PHPUnit. To run your tests, simply execute the `phpunit` command from your terminal: +Once the test has been generated, you may define test methods as you normally would using PHPUnit. To run your tests, execute the `phpunit` command from your terminal: ### Named Error Bags -If you have multiple forms on a single page, you may wish to name the `MessageBag` of errors, allowing you to retrieve the error messages for a specific form. Simply pass a name as the second argument to `withErrors`: +If you have multiple forms on a single page, you may wish to name the `MessageBag` of errors, allowing you to retrieve the error messages for a specific form. Pass a name as the second argument to `withErrors`: return redirect('register') ->withErrors($validator, 'login');