41
41
use CloudCreativity \LaravelJsonApi \Http \Responses \Responses ;
42
42
use CloudCreativity \LaravelJsonApi \Services \JsonApiService ;
43
43
use CloudCreativity \LaravelJsonApi \Validators \ValidatorErrorFactory ;
44
- use Illuminate \Contracts \Foundation \Application ;
45
44
use Illuminate \Contracts \Routing \ResponseFactory as ResponseFactoryContract ;
46
- use Illuminate \Routing \Router ;
47
45
use Illuminate \Support \ServiceProvider as BaseServiceProvider ;
46
+ use Laravel \Lumen \Application ;
48
47
use Neomerx \JsonApi \Contracts \Document \DocumentFactoryInterface ;
49
48
use Neomerx \JsonApi \Contracts \Encoder \Handlers \HandlerFactoryInterface ;
50
49
use Neomerx \JsonApi \Contracts \Encoder \Parser \ParserFactoryInterface ;
@@ -85,11 +84,9 @@ class ServiceProvider extends BaseServiceProvider
85
84
* @param ResponseFactoryContract $responses
86
85
*/
87
86
public function boot (
88
- Router $ router ,
89
- ResponseFactoryContract $ responses
87
+ Application $ router
90
88
) {
91
89
$ this ->bootMiddleware ($ router );
92
- $ this ->bootResponseMacro ($ responses );
93
90
}
94
91
95
92
/**
@@ -116,13 +113,20 @@ public function register()
116
113
*
117
114
* @param Router $router
118
115
*/
119
- protected function bootMiddleware (Router $ router )
116
+ protected function bootMiddleware (Application $ router )
120
117
{
121
118
/** Laravel 5.4 */
122
119
if (method_exists ($ router , 'aliasMiddleware ' )) {
123
120
$ router ->aliasMiddleware ('json-api ' , BootJsonApi::class);
124
121
$ router ->aliasMiddleware ('json-api.authorize ' , AuthorizeRequest::class);
125
122
$ router ->aliasMiddleware ('json-api.validate ' , ValidateRequest::class);
123
+ } /** Lumen **/
124
+ else if (method_exists ($ router , 'routeMiddleware ' )) {
125
+ $ router ->routeMiddleware ([
126
+ 'json-api ' => BootJsonApi::class,
127
+ 'json-api.authorize ' => AuthorizeRequest::class,
128
+ 'json-api.validate ' => ValidateRequest::class,
129
+ ]);
126
130
} /** Laravel 5.1|5.2|5.3 */
127
131
else {
128
132
$ router ->middleware ('json-api ' , BootJsonApi::class);
0 commit comments