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
Copy file name to clipboardexpand all lines: artisan.md
+12-8
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ php artisan help migrate
43
43
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:
44
44
45
45
```shell
46
-
./sail artisan list
46
+
./vendor/bin/sail artisan list
47
47
```
48
48
49
49
<aname="tinker"></a>
@@ -60,7 +60,8 @@ All Laravel applications include Tinker by default. However, you may install Tin
60
60
composer require laravel/tinker
61
61
```
62
62
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)!
64
65
65
66
<aname="usage"></a>
66
67
#### Usage
@@ -77,7 +78,8 @@ You can publish Tinker's configuration file using the `vendor:publish` command:
> {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.
81
83
82
84
<aname="command-allow-list"></a>
83
85
#### 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
154
156
}
155
157
}
156
158
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.
158
161
159
162
<aname="closure-commands"></a>
160
163
### Closure Commands
@@ -285,10 +288,10 @@ If you would like to define arguments or options to expect multiple input values
285
288
286
289
'mail:send {user*}'
287
290
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:
289
292
290
293
```shell
291
-
php artisan mail:send foo bar
294
+
php artisan mail:send 1 2
292
295
```
293
296
294
297
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
300
303
301
304
When defining an option that expects multiple input values, each option value passed to the command should be prefixed with the option name:
302
305
303
-
'mail:send {user} {--id=*}'
306
+
'mail:send {--id=*}'
304
307
305
308
Such a command may be invoked by passing multiple `--id` arguments:
306
309
@@ -495,7 +498,8 @@ Sometimes, you may need more manual control over how a progress bar is advanced.
495
498
496
499
$bar->finish();
497
500
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).
Copy file name to clipboardexpand all lines: authentication.md
+26-9
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,8 @@ 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
-
> {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.
43
44
44
45
<aname="starter-kits"></a>
45
46
### Starter Kits
@@ -79,7 +80,7 @@ _Laravel Breeze_ is a simple, minimal implementation of all of Laravel's authent
79
80
80
81
_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.
81
82
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.
@@ -109,12 +110,13 @@ If you are building a single-page application (SPA) that will be powered by a La
109
110
110
111
Passport may be chosen when your application absolutely needs all of the features provided by the OAuth2 specification.
111
112
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.
113
114
114
115
<aname="authentication-quickstart"></a>
115
116
## Authentication Quickstart
116
117
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).
118
120
119
121
<aname="install-a-starter-kit"></a>
120
122
### Install A Starter Kit
@@ -123,7 +125,7 @@ First, you should [install a Laravel application starter kit](/docs/{{version}}/
123
125
124
126
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.
125
127
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.
127
129
128
130
<aname="retrieving-the-authenticated-user"></a>
129
131
### Retrieving The Authenticated User
@@ -171,7 +173,8 @@ To determine if the user making the incoming HTTP request is authenticated, you
171
173
// The user is logged in...
172
174
}
173
175
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).
175
178
176
179
<aname="protecting-routes"></a>
177
180
### Protecting Routes
@@ -212,7 +215,8 @@ When attaching the `auth` middleware to a route, you may also specify which "gua
212
215
213
216
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.
214
217
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).
216
220
217
221
<aname="authenticating-users"></a>
218
222
## Manually Authenticating Users
@@ -272,7 +276,19 @@ If you wish, you may also add extra query conditions to the authentication query
272
276
// Authentication was successful...
273
277
}
274
278
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
+
}
276
292
277
293
<aname="accessing-specific-guard-instances"></a>
278
294
#### Accessing Specific Guard Instances
@@ -453,7 +469,8 @@ When the `logoutOtherDevices` method is invoked, the user's other sessions will
453
469
454
470
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.
455
471
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!
0 commit comments