Skip to content

Commit 9db7858

Browse files
authored
Merge pull request #70 from aidergroup/master
Allow middleware to be configurable through config
2 parents ad1c051 + 32f5e1e commit 9db7858

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

config/exponent-push-notifications.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
*/
88

99
return [
10+
'middleware' => [
11+
//'auth:sanctum', //<- Use only this middleware if you're using Sanctum
12+
'auth:api',
13+
'bindings'
14+
],
1015
'debug' => env('EXPONENT_PUSH_NOTIFICATION_DEBUG', true),
1116

1217
'interests' => [

src/ExpoPushNotificationsServiceProvider.php

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

33+
$router = $this->app['router'];
34+
$router->middlewareGroup('expo.middleware', config('exponent-push-notifications')['middleware']);
35+
3336
$this->loadRoutesFrom(__DIR__.'/Http/routes.php');
3437
}
3538

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' => ['auth:api', 'bindings']], 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)