@@ -69,28 +69,27 @@ public function register()
6969 $ this ->registerRouter ();
7070 $ this ->registerTransformer ();
7171 $ this ->registerExceptionHandler ();
72- //$this->registerAuthentication();
73- $ this ->registerMiddlewares ();
74-
72+ $ this ->registerMiddlewares ();
73+
7574 $ this ->app ->booting (function ($ app )
7675 {
77- // grab the setting for the auth driver your using.
78- $ shield_type = $ app ['config ' ]->get ('api::auth_provider ' );
79- $ shield_class = $ app ['config ' ]->get ("api::auth_drivers. $ shield_type " );
80-
81- $ app ['dingo.api.auth ' ] = $ app ->share (function ($ app ) use ($ shield_type , $ shield_class ) {
82- $ providers = [];
83- foreach ($ app ['config ' ]['api::auth ' ] as $ key => $ provider ) {
84- if (is_callable ($ provider )) {
85- $ provider = call_user_func ($ provider , $ app );
86- }
87- $ providers [$ key ] = $ provider ;
88- }
89- return new $ shield_class ($ app [$ shield_type ], $ app , $ providers );
90- });
91-
76+ // grab the setting for the auth driver your using.
77+ $ shield_type = $ app ['config ' ]->get ('api::auth_provider ' );
78+ $ shield_class = $ app ['config ' ]->get ("api::auth_drivers. $ shield_type " );
79+
80+ $ app ['dingo.api.auth ' ] = $ app ->share (function ($ app ) use ($ shield_type , $ shield_class ) {
81+ $ providers = [];
82+ foreach ($ app ['config ' ]['api::auth ' ] as $ key => $ provider ) {
83+ if (is_callable ($ provider )) {
84+ $ provider = call_user_func ($ provider , $ app );
85+ }
86+ $ providers [$ key ] = $ provider ;
87+ }
88+ return new $ shield_class ($ app [$ shield_type ], $ app , $ providers );
89+ });
90+
9291 $ router = $ app ['router ' ];
93-
92+
9493 $ router ->setExceptionHandler ($ app ['dingo.api.exception ' ]);
9594 $ router ->setDefaultVersion ($ app ['config ' ]['api::version ' ]);
9695 $ router ->setDefaultPrefix ($ app ['config ' ]['api::prefix ' ]);
@@ -168,34 +167,6 @@ protected function registerExceptionHandler()
168167 });
169168 }
170169
171- /**
172- * Register the API authentication.
173- *
174- * @return void
175- */
176- protected function registerAuthentication ()
177- {
178- // grab the setting for the auth driver your using.
179- $ shield_type = $ this ->app ['config ' ]->get ('api::auth_provider ' );
180- $ shield_class = $ this ->app ['config ' ]->get ("api::auth_drivers. $ shield_type " );
181- dd (compact ('shield_type ' , 'shield_class ' ));
182-
183- $ this ->app ['dingo.api.auth ' ] = $ this ->app ->share (function ($ app ) use ($ shield_type , $ shield_class )
184- {
185- $ providers = [];
186-
187- foreach ($ app ['config ' ]['api::auth ' ] as $ key => $ provider )
188- {
189- if (is_callable ($ provider ))
190- {
191- $ provider = call_user_func ($ provider , $ app );
192- }
193- $ providers [$ key ] = $ provider ;
194- }
195- return new $ shield_class ($ app [$ shield_type ], $ app , $ providers );
196- });
197- }
198-
199170 /**
200171 * Register the middlewares.
201172 *
0 commit comments