registerMiddleware($router); $this->registerMigrations(__DIR__ . '/../../database/migrations'); } /** * Register the application services. * * @return void */ public function register() { $this->commands([ ActivateApiKey::class, DeactivateApiKey::class, DeleteApiKey::class, GenerateApiKey::class, ListApiKeys::class, ]); } /** * Register middleware * * Support added for different Laravel versions * * @param Router $router */ protected function registerMiddleware(Router $router) { $versionComparison = version_compare(app()->version(), '5.4.0'); if ($versionComparison >= 0) { $router->aliasMiddleware('auth.apikey', AuthorizeApiKey::class); } else { $router->middleware('auth.apikey', AuthorizeApiKey::class); } } /** * Register migrations */ protected function registerMigrations($migrationsDirectory) { $this->publishes([ $migrationsDirectory => database_path('migrations') ], 'migrations'); } }