Skip to content

Commit 7873578

Browse files
committed
Merge branch '10.x'
# Conflicts: # migrations.md # upgrade.md
2 parents 741addf + 46c2634 commit 7873578

Some content is hidden

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

87 files changed

+3253
-1843
lines changed

artisan.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
- [Options](#options)
1313
- [Input Arrays](#input-arrays)
1414
- [Input Descriptions](#input-descriptions)
15-
- [Prompting For Missing Input](#prompting-for-missing-input)
15+
- [Prompting for Missing Input](#prompting-for-missing-input)
1616
- [Command I/O](#command-io)
1717
- [Retrieving Input](#retrieving-input)
18-
- [Prompting For Input](#prompting-for-input)
18+
- [Prompting for Input](#prompting-for-input)
1919
- [Writing Output](#writing-output)
2020
- [Registering Commands](#registering-commands)
2121
- [Programmatically Executing Commands](#programmatically-executing-commands)
@@ -62,8 +62,8 @@ All Laravel applications include Tinker by default. However, you may install Tin
6262
composer require laravel/tinker
6363
```
6464

65-
> **Note**
66-
> Looking for a graphical UI for interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!
65+
> [!NOTE]
66+
> Looking for hot reloading, multiline code editing, and autocompletion when interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!
6767
6868
<a name="usage"></a>
6969
#### Usage
@@ -80,7 +80,7 @@ You can publish Tinker's configuration file using the `vendor:publish` command:
8080
php artisan vendor:publish --provider="Laravel\Tinker\TinkerServiceProvider"
8181
```
8282

83-
> **Warning**
83+
> [!WARNING]
8484
> 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.
8585
8686
<a name="command-allow-list"></a>
@@ -155,7 +155,7 @@ Let's take a look at an example command. Note that we are able to request any de
155155
}
156156
}
157157

158-
> **Note**
158+
> [!NOTE]
159159
> 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.
160160
161161
<a name="closure-commands"></a>
@@ -203,7 +203,7 @@ When defining a closure based command, you may use the `purpose` method to add a
203203
<a name="isolatable-commands"></a>
204204
### Isolatable Commands
205205

206-
> **Warning**
206+
> [!WARNING]
207207
> To utilize this feature, your application must be using the `memcached`, `redis`, `dynamodb`, `database`, `file`, or `array` cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server.
208208
209209
Sometimes you may wish to ensure that only one instance of a command can run at a time. To accomplish this, you may implement the `Illuminate\Contracts\Console\Isolatable` interface on your command class:
@@ -388,7 +388,7 @@ You may assign descriptions to input arguments and options by separating the arg
388388
{--queue : Whether the job should be queued}';
389389

390390
<a name="prompting-for-missing-input"></a>
391-
### Prompting For Missing Input
391+
### Prompting for Missing Input
392392

393393
If your command contains required arguments, the user will receive an error message when they are not provided. Alternatively, you may configure your command to automatically prompt the user when required arguments are missing by implementing the `PromptsForMissingInput` interface:
394394

@@ -448,7 +448,7 @@ If you would like complete control over the prompt, you may provide a closure th
448448
),
449449
];
450450

451-
> **Note**
451+
> [!NOTE]
452452
The comprehensive [Laravel Prompts](/docs/{{version}}/prompts) documentation includes additional information on the available prompts and their usage.
453453

454454
If you wish to prompt the user to select or enter [options](#options), you may include prompts in your command's `handle` method. However, if you only wish to prompt the user when they have also been automatically prompted for missing arguments, then you may implement the `afterPromptingForMissingArguments` method:
@@ -503,9 +503,9 @@ Options may be retrieved just as easily as arguments using the `option` method.
503503
$options = $this->options();
504504

505505
<a name="prompting-for-input"></a>
506-
### Prompting For Input
506+
### Prompting for Input
507507

508-
> **Note**
508+
> [!NOTE]
509509
> [Laravel Prompts](/docs/{{version}}/prompts) is a PHP package for adding beautiful and user-friendly forms to your command-line applications, with browser-like features including placeholder text and validation.
510510
511511
In addition to displaying output, you may also ask the user to provide input during the execution of your command. The `ask` method will prompt the user with the given question, accept their input, and then return the user's input back to your command:
@@ -520,12 +520,16 @@ In addition to displaying output, you may also ask the user to provide input dur
520520
// ...
521521
}
522522

523+
The `ask` method also accepts an optional second argument which specifies the default value that should be returned if no user input is provided:
524+
525+
$name = $this->ask('What is your name?', 'Taylor');
526+
523527
The `secret` method is similar to `ask`, but the user's input will not be visible to them as they type in the console. This method is useful when asking for sensitive information such as passwords:
524528

525529
$password = $this->secret('What is the password?');
526530

527531
<a name="asking-for-confirmation"></a>
528-
#### Asking For Confirmation
532+
#### Asking for Confirmation
529533

530534
If you need to ask the user for a simple "yes or no" confirmation, you may use the `confirm` method. By default, this method will return `false`. However, if the user enters `y` or `yes` in response to the prompt, the method will return `true`.
531535

@@ -644,7 +648,7 @@ Sometimes, you may need more manual control over how a progress bar is advanced.
644648

645649
$bar->finish();
646650

647-
> **Note**
651+
> [!NOTE]
648652
> For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/current/components/console/helpers/progressbar.html).
649653
650654
<a name="registering-commands"></a>

authentication.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
- [Database Considerations](#introduction-database-considerations)
66
- [Ecosystem Overview](#ecosystem-overview)
77
- [Authentication Quickstart](#authentication-quickstart)
8-
- [Install A Starter Kit](#install-a-starter-kit)
9-
- [Retrieving The Authenticated User](#retrieving-the-authenticated-user)
8+
- [Install a Starter Kit](#install-a-starter-kit)
9+
- [Retrieving the Authenticated User](#retrieving-the-authenticated-user)
1010
- [Protecting Routes](#protecting-routes)
1111
- [Login Throttling](#login-throttling)
1212
- [Manually Authenticating Users](#authenticating-users)
@@ -15,7 +15,7 @@
1515
- [HTTP Basic Authentication](#http-basic-authentication)
1616
- [Stateless HTTP Basic Authentication](#stateless-http-basic-authentication)
1717
- [Logging Out](#logging-out)
18-
- [Invalidating Sessions On Other Devices](#invalidating-sessions-on-other-devices)
18+
- [Invalidating Sessions on Other Devices](#invalidating-sessions-on-other-devices)
1919
- [Password Confirmation](#password-confirmation)
2020
- [Configuration](#password-confirmation-configuration)
2121
- [Routing](#password-confirmation-routing)
@@ -39,7 +39,7 @@ 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-
> **Note**
42+
> [!NOTE]
4343
> 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.
4444
4545
<a name="starter-kits"></a>
@@ -100,7 +100,7 @@ Laravel Sanctum is a hybrid web / API authentication package that can manage you
100100
Laravel Sanctum is the API package we have chosen to include with the [Laravel Jetstream](https://jetstream.laravel.com) application starter kit because we believe it is the best fit for the majority of web application's authentication needs.
101101

102102
<a name="summary-choosing-your-stack"></a>
103-
#### Summary & Choosing Your Stack
103+
#### Summary and Choosing Your Stack
104104

105105
In summary, if your application will be accessed using a browser and you are building a monolithic Laravel application, your application will use Laravel's built-in authentication services.
106106

@@ -115,11 +115,11 @@ And, if you would like to get started quickly, we are pleased to recommend [Lara
115115
<a name="authentication-quickstart"></a>
116116
## Authentication Quickstart
117117

118-
> **Warning**
118+
> [!WARNING]
119119
> 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).
120120
121121
<a name="install-a-starter-kit"></a>
122-
### Install A Starter Kit
122+
### Install a Starter Kit
123123

124124
First, you should [install a Laravel application starter kit](/docs/{{version}}/starter-kits). Our current starter kits, Laravel Breeze and Laravel Jetstream, offer beautifully designed starting points for incorporating authentication into your fresh Laravel application.
125125

@@ -128,7 +128,7 @@ Laravel Breeze is a minimal, simple implementation of all of Laravel's authentic
128128
[Laravel Jetstream](https://jetstream.laravel.com) is a more robust application starter kit that includes support for scaffolding your application with [Livewire](https://livewire.laravel.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.
129129

130130
<a name="retrieving-the-authenticated-user"></a>
131-
### Retrieving The Authenticated User
131+
### Retrieving the Authenticated User
132132

133133
After installing an authentication starter kit and allowing users to register and authenticate with your application, you will often need to interact with the currently authenticated user. While handling an incoming request, you may access the authenticated user via the `Auth` facade's `user` method:
134134

@@ -165,7 +165,7 @@ Alternatively, once a user is authenticated, you may access the authenticated us
165165
}
166166

167167
<a name="determining-if-the-current-user-is-authenticated"></a>
168-
#### Determining If The Current User Is Authenticated
168+
#### Determining if the Current User is Authenticated
169169

170170
To determine if the user making the incoming HTTP request is authenticated, you may use the `check` method on the `Auth` facade. This method will return `true` if the user is authenticated:
171171

@@ -175,7 +175,7 @@ To determine if the user making the incoming HTTP request is authenticated, you
175175
// The user is logged in...
176176
}
177177

178-
> **Note**
178+
> [!NOTE]
179179
> 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).
180180
181181
<a name="protecting-routes"></a>
@@ -203,7 +203,7 @@ When the `auth` middleware detects an unauthenticated user, it will redirect the
203203
}
204204

205205
<a name="specifying-a-guard"></a>
206-
#### Specifying A Guard
206+
#### Specifying a Guard
207207

208208
When attaching the `auth` middleware to a route, you may also specify which "guard" should be used to authenticate the user. The guard specified should correspond to one of the keys in the `guards` array of your `auth.php` configuration file:
209209

@@ -216,7 +216,7 @@ When attaching the `auth` middleware to a route, you may also specify which "gua
216216

217217
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.
218218

219-
> **Note**
219+
> [!NOTE]
220220
> If you would like to rate limit other routes in your application, check out the [rate limiting documentation](/docs/{{version}}/routing#rate-limiting).
221221
222222
<a name="authenticating-users"></a>
@@ -287,7 +287,7 @@ For complex query conditions, you may provide a closure in your array of credent
287287
// Authentication was successful...
288288
}
289289

290-
> **Warning**
290+
> [!WARNING]
291291
> 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.
292292
293293
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:
@@ -337,7 +337,7 @@ If your application offers "remember me" functionality, you may use the `viaReme
337337
### Other Authentication Methods
338338

339339
<a name="authenticate-a-user-instance"></a>
340-
#### Authenticate A User Instance
340+
#### Authenticate a User Instance
341341

342342
If you need to set an existing user instance as the currently authenticated user, you may pass the user instance to the `Auth` facade's `login` method. The given user instance must be an implementation of the `Illuminate\Contracts\Auth\Authenticatable` [contract](/docs/{{version}}/contracts). The `App\Models\User` model included with Laravel already implements this interface. This method of authentication is useful when you already have a valid user instance, such as directly after a user registers with your application:
343343

@@ -354,7 +354,7 @@ If needed, you may specify an authentication guard before calling the `login` me
354354
Auth::guard('admin')->login($user);
355355

356356
<a name="authenticate-a-user-by-id"></a>
357-
#### Authenticate A User By ID
357+
#### Authenticate a User by ID
358358

359359
To authenticate a user using their database record's primary key, you may use the `loginUsingId` method. This method accepts the primary key of the user you wish to authenticate:
360360

@@ -365,7 +365,7 @@ You may pass a boolean value as the second argument to the `loginUsingId` method
365365
Auth::loginUsingId(1, $remember = true);
366366

367367
<a name="authenticate-a-user-once"></a>
368-
#### Authenticate A User Once
368+
#### Authenticate a User Once
369369

370370
You may use the `once` method to authenticate a user with the application for a single request. No sessions or cookies will be utilized when calling this method:
371371

@@ -385,7 +385,7 @@ You may use the `once` method to authenticate a user with the application for a
385385
Once the middleware has been attached to the route, you will automatically be prompted for credentials when accessing the route in your browser. By default, the `auth.basic` middleware will assume the `email` column on your `users` database table is the user's "username".
386386

387387
<a name="a-note-on-fastcgi"></a>
388-
#### A Note On FastCGI
388+
#### A Note on FastCGI
389389

390390
If you are using PHP FastCGI and Apache to serve your Laravel application, HTTP Basic authentication may not work correctly. To correct these problems, the following lines may be added to your application's `.htaccess` file:
391391

@@ -454,7 +454,7 @@ In addition to calling the `logout` method, it is recommended that you invalidat
454454
}
455455

456456
<a name="invalidating-sessions-on-other-devices"></a>
457-
### Invalidating Sessions On Other Devices
457+
### Invalidating Sessions on Other Devices
458458

459459
Laravel also provides a mechanism for invalidating and "logging out" a user's sessions that are active on other devices without invalidating the session on their current device. This feature is typically utilized when a user is changing or updating their password and you would like to invalidate sessions on other devices while keeping the current device authenticated.
460460

@@ -479,7 +479,7 @@ When the `logoutOtherDevices` method is invoked, the user's other sessions will
479479

480480
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.
481481

482-
> **Note**
482+
> [!NOTE]
483483
> 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!
484484
485485
<a name="password-confirmation-configuration"></a>
@@ -502,7 +502,7 @@ First, we will define a route to display a view that requests the user to confir
502502
As you might expect, the view that is returned by this route should have a form containing a `password` field. In addition, feel free to include text within the view that explains that the user is entering a protected area of the application and must confirm their password.
503503

504504
<a name="confirming-the-password"></a>
505-
#### Confirming The Password
505+
#### Confirming the Password
506506

507507
Next, we will define a route that will handle the form request from the "confirm password" view. This route will be responsible for validating the password and redirecting the user to their intended destination:
508508

0 commit comments

Comments
 (0)