I am following this tutorial to use Laravel Passport
to authenticate requests on my api
. But in my project I am using mongodb
as database
, so I had to use jenssegers/laravel-mongodb, laravel/passport (of course) and designmynight/laravel-mongodb-passport.
I did everything on the tutorial, and all the steps worked well, but in the end I tried the same request as in the tutorial for the /api/auth/signup
resource, and I get this error:
{
"message": "Call to a member function prepare() on null",
"exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php",
"line": 452,
"trace": [
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php",
"line": 657,
"function": "Illuminate\\Database\\{closure}",
"class": "Illuminate\\Database\\Connection",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php",
"line": 624,
"function": "runQueryCallback",
"class": "Illuminate\\Database\\Connection",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php",
"line": 459,
"function": "run",
"class": "Illuminate\\Database\\Connection",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php",
"line": 411,
"function": "statement",
"class": "Illuminate\\Database\\Connection",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Processors\\Processor.php",
"line": 32,
"function": "insert",
"class": "Illuminate\\Database\\Connection",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php",
"line": 2494,
"function": "processInsertGetId",
"class": "Illuminate\\Database\\Query\\Processors\\Processor",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php",
"line": 1283,
"function": "insertGetId",
"class": "Illuminate\\Database\\Query\\Builder",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php",
"line": 787,
"function": "__call",
"class": "Illuminate\\Database\\Eloquent\\Builder",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php",
"line": 752,
"function": "insertAndSetId",
"class": "Illuminate\\Database\\Eloquent\\Model",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php",
"line": 615,
"function": "performInsert",
"class": "Illuminate\\Database\\Eloquent\\Model",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\app\\Http\\Controllers\\Auth\\AuthController.php",
"line": 38,
"function": "save",
"class": "Illuminate\\Database\\Eloquent\\Model",
"type": "->"
},
{
"function": "signup",
"class": "App\\Http\\Controllers\\Auth\\AuthController",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php",
"line": 54,
"function": "call_user_func_array"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php",
"line": 45,
"function": "callAction",
"class": "Illuminate\\Routing\\Controller",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
"line": 212,
"function": "dispatch",
"class": "Illuminate\\Routing\\ControllerDispatcher",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
"line": 169,
"function": "runController",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 665,
"function": "run",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 30,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php",
"line": 41,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 151,
"function": "handle",
"class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\ThrottleRequests.php",
"line": 57,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 151,
"function": "handle",
"class": "Illuminate\\Routing\\Middleware\\ThrottleRequests",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 104,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 667,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 642,
"function": "runRouteWithinStack",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 608,
"function": "runRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 597,
"function": "dispatchToRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 176,
"function": "dispatch",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 30,
"function": "Illuminate\\Foundation\\Http\\{closure}",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\fideloper\\proxy\\src\\TrustProxies.php",
"line": 57,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 151,
"function": "handle",
"class": "Fideloper\\Proxy\\TrustProxies",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
"line": 31,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 151,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
"line": 31,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 151,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php",
"line": 27,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 151,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode.php",
"line": 62,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 151,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 104,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 151,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 116,
"function": "sendRequestThroughRouter",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\public\\index.php",
"line": 55,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "C:\\Users\\mariana\\Documents\\PHP\\Bitbucket\\passport\\alfa-mongodb\\server.php",
"line": 21,
"function": "require_once"
}
]
}
I already tried this solution, and this one, but neither worked. I dont have more ideas of what to do.
I commited the project here without .env file
if anyone want to see it.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2u3apAn
via IFTTT
Aucun commentaire:
Enregistrer un commentaire