Skip to content

Instantly share code, notes, and snippets.

@Maras0830
Last active June 4, 2016 07:46
Show Gist options
  • Save Maras0830/76d5d44f8e267292e734bd09553cd740 to your computer and use it in GitHub Desktop.
Save Maras0830/76d5d44f8e267292e734bd09553cd740 to your computer and use it in GitHub Desktop.
AuthController insert logs when user login.
<?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