I'm using Lucadegasperi's OAuth2 integration with Laravel 5.1.
I want to create a Tutorial
instance, and want to simply pass the ID via the route from the client application, and have Laravel typehint it and auto-instantiate the model App\Tutorial
for ID 1.
To do this, in my RouteServiceProvider
's boot method, I bind the model:
public function boot(Router $router)
{
parent::boot($router);
$router->model('tutorial', 'App\Tutorial');
...
}
Which allows me to typehint and instantiate the tutorial model
as {tutorial}
:
$router->post('tutorials/{tutorial}/create', 'Resources\Tutorials@createManyToMany');
So when I call that route, which calls the Resources's createManyToMany
method:
public function createManyToMany(Request $request, Route $route, Model $modelToAttach)
{
// $modelToAttach of type Model will be auto-instantiated as App\Tutorial
...
The model will be good to go.
The issue is, I wrap these routes in Lucasdegasperi's OAuth2 middleware:
$router->group(['middleware' => 'oauth'], function(Router $router) {
// routes
The server complains:
NoActiveAccessTokenException in Authorizer.php line 104:
Tried to access session data without an active access token
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire