Tuesday, March 21, 2017

Login log laravel 5

I wanted to create user logs but something does not work for me.

    protected $listen = [
    'Illuminate\Auth\Events\Login' => [
        'App\Listeners\LogSuccessfulLogin',
    ],
class LogSuccessfulLogin

{ /** * Create the event listener. * * @param Request $request * @return void */ public function __construct(User $user) { $this->user = $user; }

/**
 * Handle the event.
 *
 * @param  Login  $event
 * @return void
 */
public function handle()
{ 
    Event::listen('auth.login', function ($user, $remember) { 
        $user->update(['last_login' => \Carbon\Carbon::now(), 'ip_address' => \Request::ip()]); 
    });
}

}

I read many tutorials but did not help



via chmod

Advertisement