2016-02-29 15:59:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Contracts\Auth\Guard;
|
2018-08-15 11:26:10 +00:00
|
|
|
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-04-09 15:50:50 +00:00
|
|
|
/**
|
2016-06-15 02:31:24 +00:00
|
|
|
* Log a user out and redirect them
|
2016-04-09 15:50:50 +00:00
|
|
|
*
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
2016-03-05 00:18:10 +00:00
|
|
|
public function doLogout()
|
|
|
|
|
{
|
2016-02-29 15:59:36 +00:00
|
|
|
$this->auth->logout();
|
2018-08-15 11:26:10 +00:00
|
|
|
Session::flush();
|
2016-04-09 15:50:50 +00:00
|
|
|
return redirect()->to('/?logged_out=yup');
|
2016-02-29 15:59:36 +00:00
|
|
|
}
|
2016-03-05 00:18:10 +00:00
|
|
|
}
|