title: Laravel logging out, adding a listener
body: <p>I'm trying to add some logic to the logout function of our existing laravel site (laravel 5.2) but It's not quite as cut and dry as logging in.</p>
  
  <p>The existing logout for the client side works fine, but all I want to do is add a call to my Cognito instance to log the user out of their cognito session. Basically, when the user clicks logout then I want to log them out of the website as it already does but also hit my logout endpoint for cognito</p>
  
  <p>My confusion comes from the fact that the existing routes and controller for auth don't quite match up.</p>
  
  <p><strong>routes.api.php</strong></p>
  
  <pre><code>Route::get('logout', 'API\Auth\AuthController@getLogout');
  </code></pre>
  
  <p><strong>routes.auth.php</strong></p>
  
  <pre><code>Route::get('logout', 'Auth\AuthController@getLogout')
      -&gt;name('auth.logout');
  </code></pre>
  
  <p><strong>Auth/AuthController.php</strong> (in my constructor)</p>
  
  <pre><code>$this-&gt;middleware('guest', ['except' =&gt; 'getLogout']);
  </code></pre>
  
  <p>My logout link hits <code>site/logout</code> and it's definitely logging the user out but I want to put my call to the endpoint in the right place. I also want to make sure I flush or destroy the session on successful logout</p>
  
  <p>I've been told recently I could possibly (and likely should) add a listener for the logout event and do my call there.</p>
  
  <p>How exactly would I do that in this instance, and where exactly would it go?</p>