Attendize/app/Http/Controllers/UserLogoutController.php

29 lines
512 B
PHP
Raw Normal View History

2016-02-29 15:59:36 +00:00
<?php
namespace App\Http\Controllers;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Support\Facades\Session;
2016-02-29 15:59:36 +00:00
2016-03-05 00:18:10 +00:00
class UserLogoutController extends Controller
{
2016-02-29 15:59:36 +00:00
protected $auth;
2016-03-05 00:18:10 +00:00
public function __construct(Guard $auth)
{
2016-02-29 15:59:36 +00:00
$this->auth = $auth;
}
/**
2016-06-15 02:31:24 +00:00
* Log a user out and redirect them
*
* @return mixed
*/
2016-03-05 00:18:10 +00:00
public function doLogout()
{
2016-02-29 15:59:36 +00:00
$this->auth->logout();
Session::flush();
return redirect()->to('/?logged_out=yup');
2016-02-29 15:59:36 +00:00
}
2016-03-05 00:18:10 +00:00
}