Skip to content

Commit 87b24d4

Browse files
committed
Register middleware in container
1 parent 8e23396 commit 87b24d4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/ExpoPushNotificationsServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public function boot()
3030
return new Expo(new ExpoRegistrar($repository));
3131
});
3232

33+
$router = $this->app->make(Router::class);
34+
// It's also possible to add a middleware group
35+
$router->middlewareGroup('expo.middleware', config("exponent-push-notifications")["middleware"]);
36+
3337
$this->loadRoutesFrom(__DIR__.'/Http/routes.php');
3438
}
3539

src/Http/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
Route::group(['prefix' => 'api/exponent/devices', "middleware" => config("exponent-push-notifications")["middleware"]], function () {
3+
Route::group(['prefix' => 'api/exponent/devices', "middleware" => 'expo.middleware'], function () {
44
Route::post('subscribe', [
55
'as' => 'register-interest',
66
'uses' => 'NotificationChannels\ExpoPushNotifications\Http\ExpoController@subscribe',

0 commit comments

Comments
 (0)