commit
This commit is contained in:
parent
ad97ca506a
commit
041354e5eb
|
|
@ -29,22 +29,6 @@ return [
|
||||||
*/
|
*/
|
||||||
'client_provider' => ConfigClientProvider::class,
|
'client_provider' => ConfigClientProvider::class,
|
||||||
|
|
||||||
'dashboard' => [
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Path for the Websockets debug dashboard
|
|
||||||
*/
|
|
||||||
'path' => '/websockets',
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Middleware that will be applied to the dashboard routes.
|
|
||||||
*/
|
|
||||||
'middleware' => [
|
|
||||||
'web',
|
|
||||||
Authorize::class,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This array contains the hosts of which you want to allow incoming requests.
|
* This array contains the hosts of which you want to allow incoming requests.
|
||||||
* Leave this empty if you want to accepts requests from all hosts.
|
* Leave this empty if you want to accepts requests from all hosts.
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\AuthenticateDashboard;
|
|
||||||
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\SendMessage;
|
|
||||||
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\ShowDashboard;
|
|
||||||
|
|
||||||
Route::get('/', ShowDashboard::class);
|
|
||||||
Route::post('auth', AuthenticateDashboard::class);
|
|
||||||
Route::post('event', SendMessage::class);
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
namespace BeyondCode\LaravelWebSockets;
|
namespace BeyondCode\LaravelWebSockets;
|
||||||
|
|
||||||
use BeyondCode\LaravelWebSockets\Dashboard\EventSubscriber;
|
use BeyondCode\LaravelWebSockets\Dashboard\EventSubscriber;
|
||||||
|
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\AuthenticateDashboard;
|
||||||
|
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\SendMessage;
|
||||||
|
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\ShowDashboard;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
@ -14,13 +17,11 @@ class WebSocketsServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
Route::middlewareGroup('websockets', config('websockets.dashboard.middleware', []));
|
|
||||||
|
|
||||||
$this->publishes([
|
$this->publishes([
|
||||||
__DIR__.'/../config/websockets.php' => base_path('config/websockets.php'),
|
__DIR__.'/../config/websockets.php' => base_path('config/websockets.php'),
|
||||||
], 'config');
|
], 'config');
|
||||||
|
|
||||||
$this->registerRoutes();
|
$this->registerRouteMacro();
|
||||||
|
|
||||||
$this->registerDashboardGate();
|
$this->registerDashboardGate();
|
||||||
|
|
||||||
|
|
@ -33,21 +34,17 @@ class WebSocketsServiceProvider extends ServiceProvider
|
||||||
Event::subscribe(EventSubscriber::class);
|
Event::subscribe(EventSubscriber::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function registerRoutes()
|
protected function registerRouteMacro()
|
||||||
{
|
{
|
||||||
Route::group($this->routeConfiguration(), function () {
|
Route::macro('websocketsDashboard', function($prefix = 'websockets') {
|
||||||
$this->loadRoutesFrom(__DIR__.'/Dashboard/Http/routes.php');
|
Route::prefix($prefix)->middleware(Authorize::class)->group(function() {
|
||||||
|
Route::get('/', ShowDashboard::class);
|
||||||
|
Route::post('auth', AuthenticateDashboard::class);
|
||||||
|
Route::post('event', SendMessage::class);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function routeConfiguration()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'prefix' => config('websockets.dashboard.path'),
|
|
||||||
'middleware' => 'websockets',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->mergeConfigFrom(__DIR__.'/../config/websockets.php', 'websockets');
|
$this->mergeConfigFrom(__DIR__.'/../config/websockets.php', 'websockets');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue