publishes([ __DIR__.'/../config/websockets.php' => base_path('config/websockets.php'), ], 'config'); $this->registerRoutes(); $this->registerDashboardGate(); $this->loadViewsFrom(__DIR__.'/../resources/views/', 'websockets'); $this->commands([ Console\StartWebSocketServer::class, ]); } protected function registerRoutes() { Route::group($this->routeConfiguration(), function () { $this->loadRoutesFrom(__DIR__.'/Dashboard/Http/routes.php'); }); } protected function routeConfiguration() { return [ 'prefix' => config('websockets.dashboard.path'), 'middleware' => 'websockets', ]; } public function register() { $this->mergeConfigFrom(__DIR__.'/../config/websockets.php', 'websockets'); $this->app->singleton('websockets.router', function() { return new Router(); }); $this->app->singleton(ChannelManager::class, function() { return new ChannelManager(); }); $this->app->singleton(ClientProvider::class, function() { return app(config('websockets.client_provider')); }); } protected function registerDashboardGate() { Gate::define('viewWebSocketsDashboard', function ($user = null) { return app()->environment('local'); }); } }