Skip to content

Commit

Permalink
Add logout
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonbennett committed Jan 4, 2016
1 parent c125826 commit 9e5f8e4
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
35 changes: 35 additions & 0 deletions app/Http/Controllers/Auth/AuthLogoutController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
namespace FullRent\Core\Application\Http\Controllers\Auth;

use FullRent\Core\Application\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;

/**
* Class AuthLogoutController
* @package FullRent\Core\Application\Http\Controllers\Auth
* @author Simon Bennett <simon@bennett.im>
*/
final class AuthLogoutController extends Controller
{
/** @var Guard */
private $guard;

/**
* AuthLogoutController constructor.
* @param Guard $guard
*/
public function __construct(Guard $guard)
{
$this->guard = $guard;
}

/**
* @return mixed
*/
public function logout()
{
$this->guard->logout();

return redirect('/auth/login')->withSuccess('You have been logged out');;
}
}
1 change: 1 addition & 0 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function (Router $router) {
function (Router $router) {
$router->get('/', ['uses' => 'DashboardController@index']);

$router->get('/auth/logout','Auth\AuthLogoutController@logout');

/**
* Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function (Blueprint $table) {
$table->char('id', 36);
$table->string('email');
$table->string('password')->nullable();
$table->rememberToken();
});
}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard/layout/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@


<li>
<a href="login.html">
<a href="/auth/logout">
<i class="fa fa-sign-out"></i> Log out
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard/layout/left-sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class="caret"></b></span> </span> </a>
<li><a href="contacts.html">Contacts</a></li>
<li><a href="mailbox.html">Mailbox</a></li>
<li class="divider"></li>
<li><a href="login.html">Logout</a></li>
<li><a href="/auth/logout">Logout</a></li>
</ul>
</div>
<div class="logo-element">
Expand Down

0 comments on commit 9e5f8e4

Please sign in to comment.