Laravel 5.2 : How to access Request & Session Classes from own Event Listener?
<p>In <code>Laravel 5.2</code>, i have added my Event Listener (into <code>app\Providers\EventServiceProvider.php</code>), like:</p>

<pre><code>protected $listen = [
  'Illuminate\Auth\Events\Login' =&gt; ['App\Listeners\UserLoggedIn'],
];
</code></pre>

<p>Then generated it:</p>

<pre><code>php artisan event:generate
</code></pre>

<p>Then in the Event Listener file itself <code>app/Listeners/UserLoggedIn.php</code>, it's like:</p>

<pre><code>&lt;?php

namespace App\Listeners;

use App\Listeners\Request;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Auth\Events\Login;

class UserLoggedIn
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {

    }

    /**
     * Handle the event.
     *
     * @param  Login  $event
     * @return void
     */
    public function handle(Login $event, Request $request)
    {
        $request-&gt;session()-&gt;put('test', 'hello world!');
    }
}
</code></pre>

<p>This shows me following Errors:</p>

<pre><code>ErrorException in UserLoggedIn.php line 28:
Argument 2 passed to App\Listeners\UserLoggedIn::handle() must be an instance of App\Listeners\Request, none given
</code></pre>

<p>What did i miss, or how can i solve this please?</p>

<ul>
<li>Ultimately, i need to write into Laravel Sessions once the User has logged in.</li>
</ul>

<p>Thank you all.</p>