laravel - Error on POST Request -
i developing in laravel 5.3.
when reviewing routes, have following:
here indicates routes post. if in postman enter url (post), throw following error
the strangest thing on local server works fine, error occurred me on production server.
my code is:
api.php
route::group(['middleware' => ['api', 'auth:api']], function() { require_once 'routes/api/productroute.php';
});
routes/routes/api/userroute.php
<?php route::post('user/authenticate', [ 'as' => 'api.user.authenticate', 'uses' => 'api\usercontroller@authenticate' ]); route::post('user/register', [ 'as' => 'api.user.register', 'uses' => 'api\usercontroller@register' ]);
/app/http/controllers/api/usercontroller.php
public function authenticate(request $request) { $credentials = $request->only('email', 'password'); if (auth::attempt($credentials)) { $user = auth::user(); \db::table('oauth_access_tokens') ->where('user_id', $user->id) ->where('name', $request->platform) ->update(['revoked' => 1]); $token = $user->createtoken($request->platform)->accesstoken; return controller::apiresponse(1, compact('user', 'token')); } else{ return controller::apiresponse(-1); } }
Comments
Post a Comment