You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -62,8 +62,8 @@ All Laravel applications include Tinker by default. However, you may install Tin
62
62
composer require laravel/tinker
63
63
```
64
64
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)!
67
67
68
68
<aname="usage"></a>
69
69
#### Usage
@@ -80,7 +80,7 @@ You can publish Tinker's configuration file using the `vendor:publish` command:
> 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.
85
85
86
86
<aname="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
155
155
}
156
156
}
157
157
158
-
> **Note**
158
+
> [!NOTE]
159
159
> 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.
160
160
161
161
<aname="closure-commands"></a>
@@ -203,7 +203,7 @@ When defining a closure based command, you may use the `purpose` method to add a
203
203
<aname="isolatable-commands"></a>
204
204
### Isolatable Commands
205
205
206
-
> **Warning**
206
+
> [!WARNING]
207
207
> 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.
208
208
209
209
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
388
388
{--queue : Whether the job should be queued}';
389
389
390
390
<aname="prompting-for-missing-input"></a>
391
-
### Prompting For Missing Input
391
+
### Prompting for Missing Input
392
392
393
393
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:
394
394
@@ -448,7 +448,7 @@ If you would like complete control over the prompt, you may provide a closure th
448
448
),
449
449
];
450
450
451
-
> **Note**
451
+
> [!NOTE]
452
452
The comprehensive [Laravel Prompts](/docs/{{version}}/prompts) documentation includes additional information on the available prompts and their usage.
453
453
454
454
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.
503
503
$options = $this->options();
504
504
505
505
<aname="prompting-for-input"></a>
506
-
### Prompting For Input
506
+
### Prompting for Input
507
507
508
-
> **Note**
508
+
> [!NOTE]
509
509
> [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.
510
510
511
511
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
520
520
// ...
521
521
}
522
522
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
+
523
527
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:
524
528
525
529
$password = $this->secret('What is the password?');
526
530
527
531
<aname="asking-for-confirmation"></a>
528
-
#### Asking For Confirmation
532
+
#### Asking for Confirmation
529
533
530
534
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`.
531
535
@@ -644,7 +648,7 @@ Sometimes, you may need more manual control over how a progress bar is advanced.
644
648
645
649
$bar->finish();
646
650
647
-
> **Note**
651
+
> [!NOTE]
648
652
> For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/current/components/console/helpers/progressbar.html).
@@ -39,7 +39,7 @@ Providers define how users are retrieved from your persistent storage. Laravel s
39
39
40
40
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.
41
41
42
-
> **Note**
42
+
> [!NOTE]
43
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.
44
44
45
45
<aname="starter-kits"></a>
@@ -100,7 +100,7 @@ Laravel Sanctum is a hybrid web / API authentication package that can manage you
100
100
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.
101
101
102
102
<aname="summary-choosing-your-stack"></a>
103
-
#### Summary & Choosing Your Stack
103
+
#### Summary and Choosing Your Stack
104
104
105
105
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.
106
106
@@ -115,11 +115,11 @@ And, if you would like to get started quickly, we are pleased to recommend [Lara
115
115
<aname="authentication-quickstart"></a>
116
116
## Authentication Quickstart
117
117
118
-
> **Warning**
118
+
> [!WARNING]
119
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).
120
120
121
121
<aname="install-a-starter-kit"></a>
122
-
### Install A Starter Kit
122
+
### Install a Starter Kit
123
123
124
124
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.
125
125
@@ -128,7 +128,7 @@ Laravel Breeze is a minimal, simple implementation of all of Laravel's authentic
128
128
[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.
129
129
130
130
<aname="retrieving-the-authenticated-user"></a>
131
-
### Retrieving The Authenticated User
131
+
### Retrieving the Authenticated User
132
132
133
133
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:
134
134
@@ -165,7 +165,7 @@ Alternatively, once a user is authenticated, you may access the authenticated us
#### Determining If The Current User Is Authenticated
168
+
#### Determining if the Current User is Authenticated
169
169
170
170
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:
171
171
@@ -175,7 +175,7 @@ To determine if the user making the incoming HTTP request is authenticated, you
175
175
// The user is logged in...
176
176
}
177
177
178
-
> **Note**
178
+
> [!NOTE]
179
179
> 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).
180
180
181
181
<aname="protecting-routes"></a>
@@ -203,7 +203,7 @@ When the `auth` middleware detects an unauthenticated user, it will redirect the
203
203
}
204
204
205
205
<aname="specifying-a-guard"></a>
206
-
#### Specifying A Guard
206
+
#### Specifying a Guard
207
207
208
208
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:
209
209
@@ -216,7 +216,7 @@ When attaching the `auth` middleware to a route, you may also specify which "gua
216
216
217
217
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.
218
218
219
-
> **Note**
219
+
> [!NOTE]
220
220
> If you would like to rate limit other routes in your application, check out the [rate limiting documentation](/docs/{{version}}/routing#rate-limiting).
221
221
222
222
<aname="authenticating-users"></a>
@@ -287,7 +287,7 @@ For complex query conditions, you may provide a closure in your array of credent
287
287
// Authentication was successful...
288
288
}
289
289
290
-
> **Warning**
290
+
> [!WARNING]
291
291
> 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.
292
292
293
293
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
337
337
### Other Authentication Methods
338
338
339
339
<aname="authenticate-a-user-instance"></a>
340
-
#### Authenticate A User Instance
340
+
#### Authenticate a User Instance
341
341
342
342
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:
343
343
@@ -354,7 +354,7 @@ If needed, you may specify an authentication guard before calling the `login` me
354
354
Auth::guard('admin')->login($user);
355
355
356
356
<aname="authenticate-a-user-by-id"></a>
357
-
#### Authenticate A User By ID
357
+
#### Authenticate a User by ID
358
358
359
359
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:
360
360
@@ -365,7 +365,7 @@ You may pass a boolean value as the second argument to the `loginUsingId` method
365
365
Auth::loginUsingId(1, $remember = true);
366
366
367
367
<aname="authenticate-a-user-once"></a>
368
-
#### Authenticate A User Once
368
+
#### Authenticate a User Once
369
369
370
370
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:
371
371
@@ -385,7 +385,7 @@ You may use the `once` method to authenticate a user with the application for a
385
385
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".
386
386
387
387
<aname="a-note-on-fastcgi"></a>
388
-
#### A Note On FastCGI
388
+
#### A Note on FastCGI
389
389
390
390
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:
391
391
@@ -454,7 +454,7 @@ In addition to calling the `logout` method, it is recommended that you invalidat
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.
460
460
@@ -479,7 +479,7 @@ When the `logoutOtherDevices` method is invoked, the user's other sessions will
479
479
480
480
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.
481
481
482
-
> **Note**
482
+
> [!NOTE]
483
483
> 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!
484
484
485
485
<aname="password-confirmation-configuration"></a>
@@ -502,7 +502,7 @@ First, we will define a route to display a view that requests the user to confir
502
502
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.
503
503
504
504
<aname="confirming-the-password"></a>
505
-
#### Confirming The Password
505
+
#### Confirming the Password
506
506
507
507
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:
0 commit comments