app->resolving('auth', function ($auth, $app) { $app['events']->listen(Login::class, function ($event) use ($app) { if ($app['db']->connection()->getSchemaBuilder()->hasTable('user_login_log')) { $app['db']->table('user_login_log')->insert([ 'user_id' => $event->user->getAuthIdentifier(), 'user_agent' => $app['request']->userAgent(), 'ip' => $app['request']->ip(), 'created_at' => Carbon::now(), ]); } }); }); $this->app->singleton(Operator::class, function () { return new Operator(storage_path('app/operations.json')); }); } }