title: How to remove Sessions from the database with Laravel?
body: <p>I was trying to remove Session entries from the database's session table, which can be created using Laravel. Then I made a <code>UserController.php</code> containing nothing but the CRUD the-like functions.</p>
  
  <p>Then I started the development webserver and it connected as expected to the database. When calling a Webpage (route) e.g. <code>http://localhost:8080/session/</code> the browser opened it and in the db there was an entry of a user (me) with IP ...1 in the <code>sessions</code> table.</p>
  
  <p>Now I want to remove the session completely from the db by following the manually configured route <code>/remove</code>. The browser is guided correctly, opens the page and makes a request against the function to destroy the session. </p>
  
  <p>Has anyone an explanation and a way to a solution? Do I have to implement my own Sessions Service or is there a way in Laravel to handle it? The documentation is quite short. It states how to create one but not how to delete it completely. <a href="https://laravel.com/docs/5.2/session" rel="nofollow" title="Laravel 5.2 - Sessions">Laravel 5.2 - Sessions</a></p>
  
  <p>There is no error or exception available.</p>
  
  <p>Perhaps the record <em>was</em> removed, but Laravel creates a Session without asking so fast that I can't notice?</p>
  
  <p>Perhaps I have an error in reasoning?</p>
  
  <p>The mentioned <code>UserController.php</code>:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use App\Http\Requests;
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\DB;
  use Illuminate\Support\Facades\Redirect;
  use Illuminate\Support\Facades\Session;
  
  class UserController extends Controller{
  
  
      public function deleteSession(){
          $this-&gt;destroy(Session::getId());
          echo "Data has been perhaps removed from session table.";
      }
  
  
      public function index() {}
      public function create() {}
      public function store(Request $request) {}
      public function show($id) {}
      public function edit($id) {}
      public function update(Request $request, $id)   {}
  
  
      public function destroy($id)   {
          Session::forget($id);
          Session::flush();
      }
  }
  </code></pre>