Skip to content

Commit 9c9fb6c

Browse files
committed
Apply recent 2.x changes to 3.x
1 parent 16a7a89 commit 9c9fb6c

File tree

7 files changed

+27
-53
lines changed

7 files changed

+27
-53
lines changed

Diff for: 3.x/features/authentication.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ use Laravel\Fortify\Fortify;
3131

3232
/**
3333
* Bootstrap any application services.
34-
*
35-
* @return void
3634
*/
37-
public function boot()
35+
public function boot(): void
3836
{
3937
Fortify::loginView(function () {
4038
return view('auth.login');
@@ -75,10 +73,8 @@ use Laravel\Fortify\Fortify;
7573

7674
/**
7775
* Bootstrap any application services.
78-
*
79-
* @return void
8076
*/
81-
public function boot()
77+
public function boot(): void
8278
{
8379
// ...
8480

Diff for: 3.x/features/password-confirmation.md

+10-22
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ After adding this trait to a component, you should call the `ensurePasswordIsCon
5757
```php
5858
/**
5959
* Enable administration mode for user.
60-
*
61-
* @return void
6260
*/
63-
public function enableAdminMode()
61+
public function enableAdminMode(): void
6462
{
6563
$this->ensurePasswordIsConfirmed();
6664

@@ -129,10 +127,8 @@ After adding the `confirms-password` component to your application's user interf
129127
```php
130128
/**
131129
* Enable administration mode for user.
132-
*
133-
* @return void
134130
*/
135-
public function enableAdminMode()
131+
public function enableAdminMode(): void
136132
{
137133
$this->ensurePasswordIsConfirmed();
138134

@@ -152,24 +148,17 @@ Once the user has confirmed their password, they will not be required to re-ente
152148
If you are using the Inertia stack, you should wrap the user interface element that triggers an action requiring password confirmation with the `ConfirmsPassword` Vue component provided by Jetstream. To get started, import the `ConfirmsPassword` component into your page:
153149

154150
```js
155-
import JetConfirmsPassword from './Components/ConfirmsPassword'
156-
157-
export default {
158-
components: {
159-
JetConfirmsPassword,
160-
// ...
161-
},
162-
}
151+
import ConfirmsPassword from './Components/ConfirmsPassword.vue'
163152
```
164153

165154
Next, wrap the component around the user interface element that triggers the action that should be confirmed. Your page should listen for the `ConfirmsPassword` component's `@confirmed` event in order to trigger the method that should be called once the user's password is confirmed:
166155

167156
```html
168-
<jet-confirms-password @confirmed="enableAdminMode">
169-
<jet-button type="button" :class="{ 'opacity-25': enabling }" :disabled="enabling">
157+
<ConfirmsPassword @confirmed="enableAdminMode">
158+
<PrimaryButton type="button" :class="{ 'opacity-25': enabling }" :disabled="enabling">
170159
Enable
171-
</jet-button>
172-
</jet-confirms-password>
160+
</PrimaryButton>
161+
</ConfirmsPassword>
173162
```
174163

175164
#### Ensuring The Password Is Confirmed
@@ -192,19 +181,18 @@ Once the user has confirmed their password, they will not be required to re-ente
192181
Sometimes, you may wish to customize how the user's password is validated during confirmation. To do so, you may use the `Fortify::confirmPasswordsUsing` method. This method accepts a closure that receives the authenticated user instance and the `password` input field of the request. The closure should return `true` if the password is valid for the given user. Typically, this method should be called from the `boot` method of your `JetstreamServiceProvider`:
193182

194183
```php
184+
use App\Models\User;
195185
use Illuminate\Support\Facades\Hash;
196186
use Laravel\Fortify\Fortify;
197187

198188
/**
199189
* Bootstrap any application services.
200-
*
201-
* @return void
202190
*/
203-
public function boot()
191+
public function boot(): void
204192
{
205193
// ...
206194

207-
Fortify::confirmPasswordsUsing(function ($user, string $password) {
195+
Fortify::confirmPasswordsUsing(function (User $user, string $password) {
208196
return Hash::check($password, $user->password);
209197
});
210198
}

Diff for: 3.x/features/registration.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ use Laravel\Fortify\Fortify;
5757

5858
/**
5959
* Bootstrap any application services.
60-
*
61-
* @return void
6260
*/
63-
public function boot()
61+
public function boot(): void
6462
{
6563
Fortify::registerView(function () {
6664
return view('auth.register');

Diff for: 3.x/features/teams.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,8 @@ When building a Jetstream application that provides both API support and team su
197197
```php
198198
/**
199199
* Determine whether the user can view a flight.
200-
*
201-
* @param \App\Models\User $user
202-
* @param \App\Models\Flight $flight
203-
* @return bool
204200
*/
205-
public function view(User $user, Flight $flight)
201+
public function view(User $user, Flight $flight): bool
206202
{
207203
return $user->belongsToTeam($flight->team) &&
208204
$user->hasTeamPermission($flight->team, 'flight:view') &&

Diff for: 3.x/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Laravel Jetstream offers your choice of two frontend stacks: [Livewire](https://
1616

1717
### Livewire + Blade
1818

19-
[Laravel Livewire](https://laravel-livewire.com) is a library that makes it simple to build modern, reactive, dynamic interfaces using Laravel Blade as your templating language. This is a great stack to choose if you want to build an application that is dynamic and reactive but don't feel comfortable jumping into a full JavaScript framework like Vue.js.
19+
[Laravel Livewire](https://laravel-livewire.com) is a library that makes it simple to build modern, reactive, dynamic interfaces using Laravel Blade as your templating language. This is a great stack to choose if you want to build an application that is dynamic and reactive, and is a great alternative to a full JavaScript framework like Vue.js.
2020

2121
When using Livewire, you may pick and choose which portions of your application will be a Livewire component, while the remainder of your application can be rendered as the traditional Blade templates you are used to.
2222

Diff for: 3.x/stacks/inertia.md

+11-15
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ In other words, this stack gives you the full power of Vue.js without the comple
1111
```php
1212
use Illuminate\Http\Request;
1313
use Inertia\Inertia;
14+
use Inertia\Response;
1415

1516
/**
1617
* Show the general profile settings screen.
17-
*
18-
* @param \Illuminate\Http\Request $request
19-
* @return \Inertia\Response
2018
*/
21-
public function show(Request $request)
19+
public function show(Request $request): Response
2220
{
2321
return Inertia::render('Profile/Show', [
2422
'sessions' => $this->sessions($request)->all(),
@@ -51,10 +49,8 @@ use Laravel\Jetstream\Jetstream;
5149

5250
/**
5351
* Bootstrap any application services.
54-
*
55-
* @return void
5652
*/
57-
public function boot()
53+
public function boot(): void
5854
{
5955
// ...
6056

@@ -81,7 +77,7 @@ Jetstream's Inertia stack also includes two modal components: `DialogModal` and
8177
To illustrate the use of modals, consider the following modal that confirms a user would like to delete their account:
8278

8379
```html
84-
<jet-confirmation-modal :show="confirmingUserDeletion" @close="confirmingUserDeletion = false">
80+
<ConfirmationModal :show="confirmingUserDeletion" @close="confirmingUserDeletion = false">
8581
<template #title>
8682
Delete Account
8783
</template>
@@ -91,15 +87,15 @@ To illustrate the use of modals, consider the following modal that confirms a us
9187
</template>
9288

9389
<template #footer>
94-
<jet-secondary-button @click.native="confirmingUserDeletion = false">
90+
<SecondaryButton @click.native="confirmingUserDeletion = false">
9591
Nevermind
96-
</jet-secondary-button>
92+
</SecondaryButton>
9793

98-
<jet-danger-button class="ml-2" @click.native="deleteTeam" :class="{ 'opacity-25': form.processing }" :disabled="form.processing">
94+
<DangerButton class="ml-2" @click.native="deleteUser" :class="{ 'opacity-25': form.processing }" :disabled="form.processing">
9995
Delete Account
100-
</jet-danger-button>
96+
</DangerButton>
10197
</template>
102-
</jet-confirmation-modal>
98+
</ConfirmationModal>
10399
```
104100

105101
As you can see, the modal's open / close state is determined by a `show` property that is declared on the component. The modal's contents may be specified by hydrating three slots: `title`, `content`, and `footer`.
@@ -109,7 +105,7 @@ As you can see, the modal's open / close state is determined by a `show` propert
109105
Jetstream's Inertia stack includes Tighten's Ziggy library as a JavaScript alternative to the Laravel `route()` helper. You can refer to the [Ziggy usage documentation](https://github.com/tighten/ziggy#usage) for a complete guide on using this library, but some common examples can be found in Jetstream's own Vue files, including `Layouts/AppLayout.vue`:
110106

111107
```html
112-
<jet-nav-link :href="route('dashboard')" :active="route().current('dashboard')">
108+
<NavLink :href="route('dashboard')" :active="route().current('dashboard')">
113109
Dashboard
114-
</jet-nav-link>
110+
</NavLink>
115111
```

Diff for: 3.x/stacks/livewire.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Introduction
66

7-
Laravel Livewire is a library that makes it simple to build modern, reactive, dynamic interfaces using Laravel Blade as your templating language. This is a great stack to choose if you want to build an application that is dynamic and reactive but don't feel comfortable jumping into a full JavaScript framework like Vue.js.
7+
Laravel Livewire is a library that makes it simple to build modern, reactive, dynamic interfaces using Laravel Blade as your templating language. This is a great stack to choose if you want to build an application that is dynamic and reactive, and is a great alternative to a full JavaScript framework like Vue.js.
88

99
When using Livewire, your application's routes will respond with typical Blade templates. However, within these templates you may render Livewire components as necessary:
1010

0 commit comments

Comments
 (0)