Question: I have a route like this in `routes/api.php`:

```
Route::group(['middleware' => 'auth:api'], function() {

    Route::post('messages/{pet}', 'MessageController@store')->middleware('can:create,message');

});

```

We see here that it has implicit `{pet}`.

My controller accesses `{pet}` just fine like this:

`app\Http\Controllers\MessageController.php`:

```
public function store(Request $request, Pet $pet)
{
    dd($pet);
}

```

I want to my `->middleware('can:create,message')` to get the arguments of `store` seen here, so I want `$request` and `$pet`, is this possible?

Here is my current `MessagePolicy@create` but its not getting the arguments I expect:

`app\Policies\MessagePolicy.php`

```
public function create(User $user, Request $request, Pet $pet)
{
    dd($request); // dd($pet);
    return $user->can('view', $pet) && ($request->input('kind') == null|| $request->input('kind') == 'PLAIN');
}

```

Also `dd` is not working for some reason.

Answer: 
Assuming you want create a Pet for a given message, in this case the [implicit model binding](https://laravel.com/docs/5.5/routing#implicit-binding) will not work here because the pet not yet created so finding a pet by the given id will always return null.

In this case laravel offer the possibility to use Actions That Don't Require Models (see [documentation](https://laravel.com/docs/5.5/authorization#authorizing-actions-using-policies) -> Via Middleware section)

> 
> Again, some actions like create may not require a model instance. In
>  these situations, you may pass a class name to the middleware. The
>  class name will be used to determine which policy to use when
>  authorizing the action
> 
> 
> 

---

So in your case :

```
Route::group(['middleware' => 'auth:api'], function() {

    Route::post('messages/{pet}', 'MessageController@store')->middleware('can:create,App\Pet');

});

```

And in the **PetPolicy** you can use the request() helper method :

```
public function create(User $user)
{
    return request('kind') == null|| request('kind') == 'PLAIN';
}

```
You could use the **request()** helper method.

<https://laravel.com/docs/5.5/helpers#method-request>