mardi 26 septembre 2017

Middleware not working for API Routes

I have some middleware created to change database on the fly. Those middelwares are working fine in web.php But when i am using the same middleware in api.php they are not working.

Here is my code for API.php

Route::group(['middleware' => ['subdomain_setup','auth:api','api'],'prefix'=>'v1'], function () {
    Route::get('getCoupons','Api\CouponAPI@getCoupons');
});

The Subdomain_setup middleware changes the databse according to the sub domain. But its not working with api routes so i am getting this error while accessing my api route

 Unknown column 'api_token' in 'where clause' (SQL: select * from `users` where `api_token` = 

in the default connection users table does not have api_token so the database is not changing.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire