Skip to content

Commit 2da721f

Browse files
committed
add event
1 parent 6d9e142 commit 2da721f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Laravel\Fortify\Events;
4+
5+
use Illuminate\Foundation\Events\Dispatchable;
6+
7+
class PasswordUpdatedViaController
8+
{
9+
use Dispatchable;
10+
11+
/**
12+
* The user instance.
13+
*
14+
* @var \App\Models\User
15+
*/
16+
public $user;
17+
18+
/**
19+
* Create a new event instance.
20+
*
21+
* @param \App\Models\User $user
22+
* @return void
23+
*/
24+
public function __construct($user)
25+
{
26+
$this->user = $user;
27+
}
28+
}

src/Http/Controllers/PasswordController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Routing\Controller;
77
use Laravel\Fortify\Contracts\PasswordUpdateResponse;
88
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
9+
use Laravel\Fortify\Events\PasswordUpdatedViaController;
910

1011
class PasswordController extends Controller
1112
{
@@ -20,6 +21,8 @@ public function update(Request $request, UpdatesUserPasswords $updater)
2021
{
2122
$updater->update($request->user(), $request->all());
2223

24+
event(new PasswordUpdatedViaController($request->user()));
25+
2326
return app(PasswordUpdateResponse::class);
2427
}
2528
}

0 commit comments

Comments
 (0)