I am developing an API using Laravel for use with a mobile app and am having some issues with Route Model Binding on nested routes.
The app will have a standalone sqlite db which will synchronise client journeys with the central server when network is available. For that reason, the PK's in the app cannot be used to access the records on the central server. Each user will have a unique username which will be stored on the central server in a table with the following columns:

> 
> * user\_id
> * username
> 
> 
> 

The journey table will then have the following columns:

> 
> * journey\_id
> * user\_id
> * user\_journey\_id
> 
> 
> 

where the `user_journey_id` will be the PK of the journey record on the client device.
The idea is that the clients can then access the api with something like:
<http://example.com/api/client/UNIQUE_USERNAME/journey/1234>
to retrieve the journey from the central server.

I have the following resources setup:

```
Route::resource('client','ClientController');
Route::resource('client.journey','JourneyController');

```

and have setup route model binding successfully for the client as follows:

```
$router->bind('client', function($value, $route) {
    return \App\Client::where('username', '=', $value)->firstOrFail();
});

```

I'm having a bit of trouble with setting up the nested model binding as I require the client `username` in combination with the `user_journey_id` to retrieve the correct journey. Is there a way to do this with route model binding?   

Or should this just be done in the controller with some like:

```
public function show(Client $client, $user_journey_id)
{
   ... // have logic here to get the journey.

```

This is how I do it currently but the route model binding would certainly make it a bit easier.