Skip to content

Commit e76ecee

Browse files
committedSep 7, 2022
Merge branch '9.x' of https://github.com/laravel/docs into laravel-9.x
2 parents 95b2855 + a91fe97 commit e76ecee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3800
-1759
lines changed
 

‎artisan.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ php artisan help migrate
4343
If you are using [Laravel Sail](/docs/{{version}}/sail) as your local development environment, remember to use the `sail` command line to invoke Artisan commands. Sail will execute your Artisan commands within your application's Docker containers:
4444

4545
```shell
46-
./sail artisan list
46+
./vendor/bin/sail artisan list
4747
```
4848

4949
<a name="tinker"></a>
@@ -60,7 +60,8 @@ All Laravel applications include Tinker by default. However, you may install Tin
6060
composer require laravel/tinker
6161
```
6262

63-
> {tip} Looking for a graphical UI for interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!
63+
> **Note**
64+
> Looking for a graphical UI for interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!
6465
6566
<a name="usage"></a>
6667
#### Usage
@@ -77,7 +78,8 @@ You can publish Tinker's configuration file using the `vendor:publish` command:
7778
php artisan vendor:publish --provider="Laravel\Tinker\TinkerServiceProvider"
7879
```
7980

80-
> {note} The `dispatch` helper function and `dispatch` method on the `Dispatchable` class depends on garbage collection to place the job on the queue. Therefore, when using tinker, you should use `Bus::dispatch` or `Queue::push` to dispatch jobs.
81+
> **Warning**
82+
> The `dispatch` helper function and `dispatch` method on the `Dispatchable` class depends on garbage collection to place the job on the queue. Therefore, when using tinker, you should use `Bus::dispatch` or `Queue::push` to dispatch jobs.
8183
8284
<a name="command-allow-list"></a>
8385
#### Command Allow List
@@ -154,7 +156,8 @@ Let's take a look at an example command. Note that we are able to request any de
154156
}
155157
}
156158

157-
> {tip} For greater code reuse, it is good practice to keep your console commands light and let them defer to application services to accomplish their tasks. In the example above, note that we inject a service class to do the "heavy lifting" of sending the e-mails.
159+
> **Note**
160+
> For greater code reuse, it is good practice to keep your console commands light and let them defer to application services to accomplish their tasks. In the example above, note that we inject a service class to do the "heavy lifting" of sending the e-mails.
158161
159162
<a name="closure-commands"></a>
160163
### Closure Commands
@@ -285,10 +288,10 @@ If you would like to define arguments or options to expect multiple input values
285288

286289
'mail:send {user*}'
287290

288-
When calling this method, the `user` arguments may be passed in order to the command line. For example, the following command will set the value of `user` to an array with `foo` and `bar` as its values:
291+
When calling this method, the `user` arguments may be passed in order to the command line. For example, the following command will set the value of `user` to an array with `1` and `2` as its values:
289292

290293
```shell
291-
php artisan mail:send foo bar
294+
php artisan mail:send 1 2
292295
```
293296

294297
This `*` character can be combined with an optional argument definition to allow zero or more instances of an argument:
@@ -300,7 +303,7 @@ This `*` character can be combined with an optional argument definition to allow
300303

301304
When defining an option that expects multiple input values, each option value passed to the command should be prefixed with the option name:
302305

303-
'mail:send {user} {--id=*}'
306+
'mail:send {--id=*}'
304307

305308
Such a command may be invoked by passing multiple `--id` arguments:
306309

@@ -495,7 +498,8 @@ Sometimes, you may need more manual control over how a progress bar is advanced.
495498

496499
$bar->finish();
497500

498-
> {tip} For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/current/components/console/helpers/progressbar.html).
501+
> **Note**
502+
> For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/current/components/console/helpers/progressbar.html).
499503
500504
<a name="registering-commands"></a>
501505
## Registering Commands

‎authentication.md

+26-9
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ Providers define how users are retrieved from your persistent storage. Laravel s
3939

4040
Your application's authentication configuration file is located at `config/auth.php`. This file contains several well-documented options for tweaking the behavior of Laravel's authentication services.
4141

42-
> {tip} Guards and providers should not be confused with "roles" and "permissions". To learn more about authorizing user actions via permissions, please refer to the [authorization](/docs/{{version}}/authorization) documentation.
42+
> **Note**
43+
> Guards and providers should not be confused with "roles" and "permissions". To learn more about authorizing user actions via permissions, please refer to the [authorization](/docs/{{version}}/authorization) documentation.
4344
4445
<a name="starter-kits"></a>
4546
### Starter Kits
@@ -79,7 +80,7 @@ _Laravel Breeze_ is a simple, minimal implementation of all of Laravel's authent
7980

8081
_Laravel Fortify_ is a headless authentication backend for Laravel that implements many of the features found in this documentation, including cookie-based authentication as well as other features such as two-factor authentication and email verification. Fortify provides the authentication backend for Laravel Jetstream or may be used independently in combination with [Laravel Sanctum](/docs/{{version}}/sanctum) to provide authentication for an SPA that needs to authenticate with Laravel.
8182

82-
_[Laravel Jetstream](https://jetstream.laravel.com)_ is a robust application starter kit that consumes and exposes Laravel Fortify's authentication services with a beautiful, modern UI powered by [Tailwind CSS](https://tailwindcss.com), [Livewire](https://laravel-livewire.com), and / or [Inertia.js](https://inertiajs.com). Laravel Jetstream includes optional support for two-factor authentication, team support, browser session management, profile management, and built-in integration with [Laravel Sanctum](/docs/{{version}}/sanctum) to offer API token authentication. Laravel's API authentication offerings are discussed below.
83+
_[Laravel Jetstream](https://jetstream.laravel.com)_ is a robust application starter kit that consumes and exposes Laravel Fortify's authentication services with a beautiful, modern UI powered by [Tailwind CSS](https://tailwindcss.com), [Livewire](https://laravel-livewire.com), and / or [Inertia](https://inertiajs.com). Laravel Jetstream includes optional support for two-factor authentication, team support, browser session management, profile management, and built-in integration with [Laravel Sanctum](/docs/{{version}}/sanctum) to offer API token authentication. Laravel's API authentication offerings are discussed below.
8384

8485
<a name="laravels-api-authentication-services"></a>
8586
#### Laravel's API Authentication Services
@@ -109,12 +110,13 @@ If you are building a single-page application (SPA) that will be powered by a La
109110

110111
Passport may be chosen when your application absolutely needs all of the features provided by the OAuth2 specification.
111112

112-
And, if you would like to get started quickly, we are pleased to recommend [Laravel Jetstream](https://jetstream.laravel.com) as a quick way to start a new Laravel application that already uses our preferred authentication stack of Laravel's built-in authentication services and Laravel Sanctum.
113+
And, if you would like to get started quickly, we are pleased to recommend [Laravel Breeze](/docs/{{version}}/starter-kits#laravel-breeze) as a quick way to start a new Laravel application that already uses our preferred authentication stack of Laravel's built-in authentication services and Laravel Sanctum.
113114

114115
<a name="authentication-quickstart"></a>
115116
## Authentication Quickstart
116117

117-
> {note} This portion of the documentation discusses authenticating users via the [Laravel application starter kits](/docs/{{version}}/starter-kits), which includes UI scaffolding to help you get started quickly. If you would like to integrate with Laravel's authentication systems directly, check out the documentation on [manually authenticating users](#authenticating-users).
118+
> **Warning**
119+
> This portion of the documentation discusses authenticating users via the [Laravel application starter kits](/docs/{{version}}/starter-kits), which includes UI scaffolding to help you get started quickly. If you would like to integrate with Laravel's authentication systems directly, check out the documentation on [manually authenticating users](#authenticating-users).
118120
119121
<a name="install-a-starter-kit"></a>
120122
### Install A Starter Kit
@@ -123,7 +125,7 @@ First, you should [install a Laravel application starter kit](/docs/{{version}}/
123125

124126
Laravel Breeze is a minimal, simple implementation of all of Laravel's authentication features, including login, registration, password reset, email verification, and password confirmation. Laravel Breeze's view layer is made up of simple [Blade templates](/docs/{{version}}/blade) styled with [Tailwind CSS](https://tailwindcss.com). Breeze also offers an [Inertia](https://inertiajs.com) based scaffolding option using Vue or React.
125127

126-
[Laravel Jetstream](https://jetstream.laravel.com) is a more robust application starter kit that includes support for scaffolding your application with [Livewire](https://laravel-livewire.com) or [Inertia.js and Vue](https://inertiajs.com). In addition, Jetstream features optional support for two-factor authentication, teams, profile management, browser session management, API support via [Laravel Sanctum](/docs/{{version}}/sanctum), account deletion, and more.
128+
[Laravel Jetstream](https://jetstream.laravel.com) is a more robust application starter kit that includes support for scaffolding your application with [Livewire](https://laravel-livewire.com) or [Inertia and Vue](https://inertiajs.com). In addition, Jetstream features optional support for two-factor authentication, teams, profile management, browser session management, API support via [Laravel Sanctum](/docs/{{version}}/sanctum), account deletion, and more.
127129

128130
<a name="retrieving-the-authenticated-user"></a>
129131
### Retrieving The Authenticated User
@@ -171,7 +173,8 @@ To determine if the user making the incoming HTTP request is authenticated, you
171173
// The user is logged in...
172174
}
173175

174-
> {tip} Even though it is possible to determine if a user is authenticated using the `check` method, you will typically use a middleware to verify that the user is authenticated before allowing the user access to certain routes / controllers. To learn more about this, check out the documentation on [protecting routes](/docs/{{version}}/authentication#protecting-routes).
176+
> **Note**
177+
> Even though it is possible to determine if a user is authenticated using the `check` method, you will typically use a middleware to verify that the user is authenticated before allowing the user access to certain routes / controllers. To learn more about this, check out the documentation on [protecting routes](/docs/{{version}}/authentication#protecting-routes).
175178
176179
<a name="protecting-routes"></a>
177180
### Protecting Routes
@@ -212,7 +215,8 @@ When attaching the `auth` middleware to a route, you may also specify which "gua
212215

213216
If you are using the Laravel Breeze or Laravel Jetstream [starter kits](/docs/{{version}}/starter-kits), rate limiting will automatically be applied to login attempts. By default, the user will not be able to login for one minute if they fail to provide the correct credentials after several attempts. The throttling is unique to the user's username / email address and their IP address.
214217

215-
> {tip} If you would like to rate limit other routes in your application, check out the [rate limiting documentation](/docs/{{version}}/routing#rate-limiting).
218+
> **Note**
219+
> If you would like to rate limit other routes in your application, check out the [rate limiting documentation](/docs/{{version}}/routing#rate-limiting).
216220
217221
<a name="authenticating-users"></a>
218222
## Manually Authenticating Users
@@ -272,7 +276,19 @@ If you wish, you may also add extra query conditions to the authentication query
272276
// Authentication was successful...
273277
}
274278

275-
> {note} In these examples, `email` is not a required option, it is merely used as an example. You should use whatever column name corresponds to a "username" in your database table.
279+
> **Warning**
280+
> In these examples, `email` is not a required option, it is merely used as an example. You should use whatever column name corresponds to a "username" in your database table.
281+
282+
The `attemptWhen` method, which receives a closure as its second argument, may be used to perform more extensive inspection of the potential user before actually authenticating the user. The closure receives the potential user and should return `true` or `false` to indicate if the user may be authenticated:
283+
284+
if (Auth::attemptWhen([
285+
'email' => $email,
286+
'password' => $password,
287+
], function ($user) {
288+
return $user->isNotBanned();
289+
})) {
290+
// Authentication was successful...
291+
}
276292

277293
<a name="accessing-specific-guard-instances"></a>
278294
#### Accessing Specific Guard Instances
@@ -453,7 +469,8 @@ When the `logoutOtherDevices` method is invoked, the user's other sessions will
453469

454470
While building your application, you may occasionally have actions that should require the user to confirm their password before the action is performed or before the user is redirected to a sensitive area of the application. Laravel includes built-in middleware to make this process a breeze. Implementing this feature will require you to define two routes: one route to display a view asking the user to confirm their password and another route to confirm that the password is valid and redirect the user to their intended destination.
455471

456-
> {tip} The following documentation discusses how to integrate with Laravel's password confirmation features directly; however, if you would like to get started more quickly, the [Laravel application starter kits](/docs/{{version}}/starter-kits) include support for this feature!
472+
> **Note**
473+
> The following documentation discusses how to integrate with Laravel's password confirmation features directly; however, if you would like to get started more quickly, the [Laravel application starter kits](/docs/{{version}}/starter-kits) include support for this feature!
457474
458475
<a name="password-confirmation-configuration"></a>
459476
### Configuration

0 commit comments

Comments
 (0)
Please sign in to comment.