Breaking fix for composer update
This commit is contained in:
parent
37719bf77a
commit
84ef4ce14e
|
|
@ -13,6 +13,7 @@ use BeyondCode\LaravelWebSockets\Statistics\Http\Controllers\WebSocketStatistics
|
||||||
use BeyondCode\LaravelWebSockets\Statistics\Http\Middleware\Authorize as AuthorizeStatistics;
|
use BeyondCode\LaravelWebSockets\Statistics\Http\Middleware\Authorize as AuthorizeStatistics;
|
||||||
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
|
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
|
||||||
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager;
|
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
@ -23,12 +24,13 @@ class WebSocketsServiceProvider extends ServiceProvider
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->publishes([
|
$this->publishes([
|
||||||
__DIR__.'/../config/websockets.php' => base_path('config/websockets.php'),
|
__DIR__ . '/../config/websockets.php' => base_path('config/websockets.php'),
|
||||||
], 'config');
|
], 'config');
|
||||||
|
|
||||||
if (! Schema::hasTable('websockets_statistics_entries')) {
|
try {
|
||||||
|
if (!Schema::hasTable('websockets_statistics_entries')) {
|
||||||
$this->publishes([
|
$this->publishes([
|
||||||
__DIR__.'/../database/migrations/create_websockets_statistics_entries_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_websockets_statistics_entries_table.php'),
|
__DIR__ . '/../database/migrations/create_websockets_statistics_entries_table.php.stub' => database_path('migrations/' . date('Y_m_d_His', time()) . '_create_websockets_statistics_entries_table.php'),
|
||||||
], 'migrations');
|
], 'migrations');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,18 +38,24 @@ class WebSocketsServiceProvider extends ServiceProvider
|
||||||
->registerRoutes()
|
->registerRoutes()
|
||||||
->registerDashboardGate();
|
->registerDashboardGate();
|
||||||
|
|
||||||
$this->loadViewsFrom(__DIR__.'/../resources/views/', 'websockets');
|
$this->loadViewsFrom(__DIR__ . '/../resources/views/', 'websockets');
|
||||||
|
|
||||||
$this->commands([
|
$this->commands([
|
||||||
Console\StartWebSocketServer::class,
|
Console\StartWebSocketServer::class,
|
||||||
Console\CleanStatistics::class,
|
Console\CleanStatistics::class,
|
||||||
Console\RestartWebSocketServer::class,
|
Console\RestartWebSocketServer::class,
|
||||||
]);
|
]);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
// Exception raised by composer update
|
||||||
|
// Usually happens when doing on CI where no DB exists at start
|
||||||
|
// Either way if DB connection not obtained
|
||||||
|
// Catching and doing nothing is ignore for composer update
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->mergeConfigFrom(__DIR__.'/../config/websockets.php', 'websockets');
|
$this->mergeConfigFrom(__DIR__ . '/../config/websockets.php', 'websockets');
|
||||||
|
|
||||||
$this->app->singleton('websockets.router', function () {
|
$this->app->singleton('websockets.router', function () {
|
||||||
return new Router();
|
return new Router();
|
||||||
|
|
@ -63,6 +71,9 @@ class WebSocketsServiceProvider extends ServiceProvider
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
protected function registerRoutes()
|
protected function registerRoutes()
|
||||||
{
|
{
|
||||||
Route::prefix(config('websockets.path'))->group(function () {
|
Route::prefix(config('websockets.path'))->group(function () {
|
||||||
|
|
@ -81,6 +92,9 @@ class WebSocketsServiceProvider extends ServiceProvider
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
protected function registerDashboardGate()
|
protected function registerDashboardGate()
|
||||||
{
|
{
|
||||||
Gate::define('viewWebSocketsDashboard', function ($user = null) {
|
Gate::define('viewWebSocketsDashboard', function ($user = null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue