Add PasswordChanged mail
MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
+use Illuminate\Http\Request;
+use App\Mail\PasswordChanged;
use Auth;
use Image;
use Storage;
use Hash;
+use Mail;
class SettingsController extends Controller {
public function index() {
@@ -49,6 +51,11 @@ class SettingsController extends Controller {
$user->save();
+ // If password changed
+ if ($request->input('password')) {
+ Mail::to($user->email)->queue(new PasswordChanged($user->updated_at));
+ }
+
return redirect()->route('settings');
}
}

ADD
app/Mail/PasswordChanged.php
+<?php
+
+namespace App\Mail;
+
+use Illuminate\Bus\Queueable;
+use Illuminate\Mail\Mailable;
+use Illuminate\Queue\SerializesModels;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use App\User;
+
+class PasswordChanged extends Mailable {
+ use Queueable, SerializesModels;
+
+ protected $updated_at;
+
+ public function __construct($updated_at) {
+ $this->updated_at = $updated_at;
+ }
+
+ public function build() {
+ return $this->view('emails.password_changed')
+ ->with([
+ 'updated_at' => $this->updated_at
+ ]);
+ }
+}

ADD
resources/views/emails/password_changed.blade.php
+Heads up! Your password has been changed ({{ $updated_at }} CEST).

Add PasswordChanged mail