Last active
June 4, 2016 07:46
AuthController insert logs when user login.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Controllers; | |
use Auth; | |
use Illuminate\Routing\Controller; | |
use Maras\Contracts\LogsRepositoryInterface; | |
class AuthController extends Controller | |
{ | |
protected $logsRepository; | |
/** | |
* Create AuthController. | |
* | |
* @param LogsRepository $logsRepository | |
* @return void | |
*/ | |
public function __construct(LogsRepositoryInterface $logsRepository) | |
{ | |
$this->logsRepository = $logsRepository; | |
} | |
/** | |
* Handle an authentication attempt. | |
* | |
* @return Response | |
*/ | |
public function authenticate() | |
{ | |
if (Auth::attempt(['email' => $email, 'password' => $password])) | |
{ | |
$this->logsRepository->insertMemberLoginLogs(Auth::user(), $this->request->ip(), Carbon::NOW()); | |
return redirect()->intended('dashboard'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment