Skip to content

Commit

Permalink
add event
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 27, 2023
1 parent 6d9e142 commit 2da721f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Events/PasswordUpdatedViaController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Laravel\Fortify\Events;

use Illuminate\Foundation\Events\Dispatchable;

class PasswordUpdatedViaController
{
use Dispatchable;

/**
* The user instance.
*
* @var \App\Models\User
*/
public $user;

/**
* Create a new event instance.
*
* @param \App\Models\User $user
* @return void
*/
public function __construct($user)
{
$this->user = $user;
}
}
3 changes: 3 additions & 0 deletions src/Http/Controllers/PasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Routing\Controller;
use Laravel\Fortify\Contracts\PasswordUpdateResponse;
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
use Laravel\Fortify\Events\PasswordUpdatedViaController;

class PasswordController extends Controller
{
Expand All @@ -20,6 +21,8 @@ public function update(Request $request, UpdatesUserPasswords $updater)
{
$updater->update($request->user(), $request->all());

event(new PasswordUpdatedViaController($request->user()));

return app(PasswordUpdateResponse::class);
}
}

0 comments on commit 2da721f

Please sign in to comment.