From bde6c0f1ffba72b894ce72e7e36620b20aad97e9 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 23 Jul 2018 11:26:02 -0600 Subject: [PATCH] Update LoginController --- app/Http/Controllers/Auth/LoginController.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 83f844da6..af596e02c 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Auth; +use App\{AccountLog, User}; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; @@ -25,7 +26,7 @@ class LoginController extends Controller * * @var string */ - protected $redirectTo = '/home'; + protected $redirectTo = '/'; /** * Create a new controller instance. @@ -56,4 +57,25 @@ class LoginController extends Controller $this->validate($request, $rules); } + + /** + * The user has been authenticated. + * + * @param \Illuminate\Http\Request $request + * @param mixed $user + * @return mixed + */ + protected function authenticated($request, $user) + { + $log = new AccountLog; + $log->user_id = $user->id; + $log->item_id = $user->id; + $log->item_type = 'App\User'; + $log->action = 'auth.login'; + $log->message = 'Account Login'; + $log->link = null; + $log->ip_address = $request->ip(); + $log->user_agent = $request->userAgent(); + $log->save(); + } }