{"action":"created","issue":{"url":"https://api.github.com/repos/mcamara/laravel-localization/issues/268","labels_url":"https://api.github.com/repos/mcamara/laravel-localization/issues/268/labels{/name}","comments_url":"https://api.github.com/repos/mcamara/laravel-localization/issues/268/comments","events_url":"https://api.github.com/repos/mcamara/laravel-localization/issues/268/events","html_url":"https://github.com/mcamara/laravel-localization/issues/268","id":121000814,"number":268,"title":"Route Translation with Model Binding not working","user":{"login":"JimLfe","id":13345669,"avatar_url":"https://avatars.githubusercontent.com/u/13345669?v=3","gravatar_id":"","url":"https://api.github.com/users/JimLfe","html_url":"https://github.com/JimLfe","followers_url":"https://api.github.com/users/JimLfe/followers","following_url":"https://api.github.com/users/JimLfe/following{/other_user}","gists_url":"https://api.github.com/users/JimLfe/gists{/gist_id}","starred_url":"https://api.github.com/users/JimLfe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JimLfe/subscriptions","organizations_url":"https://api.github.com/users/JimLfe/orgs","repos_url":"https://api.github.com/users/JimLfe/repos","events_url":"https://api.github.com/users/JimLfe/events{/privacy}","received_events_url":"https://api.github.com/users/JimLfe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-08T12:56:22Z","updated_at":"2015-12-10T18:51:18Z","closed_at":null,"body":"I have a issue with route translation with Model Binding, the route translation isn't working then:\r\n\r\nHttp/routes.php\r\n> Route::get(LaravelLocalization::transRoute('routes.firma/abdeckung/id'), ['uses' => 'FirmaController@abdeckung']);\r\n\r\nen/routes.php\r\n> \"firma/abdeckung/id\"    =>  \"company/coverage/{firma}\",\r\n\r\nde/routes.php\r\n> \"firma/abdeckung/id\"    =>  \"firma/abdeckung/{firma}\",\r\n\r\nI use Model Binding in app/Providers/RouteServiceProvider.php\r\n> $router->model('firma', '\\App\\Firma');\r\n\r\nNow if I am on the German site and push the link for English, it redirects me from:\r\n> de/firma/abdeckung/2\r\n\r\nto\r\n> en/firma/abdeckung/2\r\n\r\ninstead of \r\n> en/company/coverage/2\r\n\r\nIt looks like its a Problem of the model binding, because if i take the model binding out, it works perfectly. Does anyone know something about this?\r\n\r\n(I know there is also the possibility to translate the attributes, but I thought I will first get this to work without it)"},"comment":{"url":"https://api.github.com/repos/mcamara/laravel-localization/issues/comments/163715630","html_url":"https://github.com/mcamara/laravel-localization/issues/268#issuecomment-163715630","issue_url":"https://api.github.com/repos/mcamara/laravel-localization/issues/268","id":163715630,"user":{"login":"arcanedev-maroc","id":3282340,"avatar_url":"https://avatars.githubusercontent.com/u/3282340?v=3","gravatar_id":"","url":"https://api.github.com/users/arcanedev-maroc","html_url":"https://github.com/arcanedev-maroc","followers_url":"https://api.github.com/users/arcanedev-maroc/followers","following_url":"https://api.github.com/users/arcanedev-maroc/following{/other_user}","gists_url":"https://api.github.com/users/arcanedev-maroc/gists{/gist_id}","starred_url":"https://api.github.com/users/arcanedev-maroc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arcanedev-maroc/subscriptions","organizations_url":"https://api.github.com/users/arcanedev-maroc/orgs","repos_url":"https://api.github.com/users/arcanedev-maroc/repos","events_url":"https://api.github.com/users/arcanedev-maroc/events{/privacy}","received_events_url":"https://api.github.com/users/arcanedev-maroc/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T18:51:18Z","updated_at":"2015-12-10T18:51:18Z","body":"I don't know if the problem is caused by using the model binding.\r\n\r\nYou need to edit your `routes.php` in lang folders, instead of using keys with `/`, try to do something like this :\r\n```php\r\n// resources/lang/de/routes.php\r\n\r\nreturn [\r\n    'firma-abdeckung-id' => 'firma/abdeckung/{firma}',\r\n    // LaravelLocalization::transRoute('routes.firma-abdeckung-id')\r\n];\r\n\r\n// OR like this (I don't know if this package support it or not)\r\nreturn [\r\n    'firma-id' => [\r\n        'abdeckung' => [\r\n            'show' => 'firma/abdeckung/{firma}',\r\n            // LaravelLocalization::transRoute('routes.firma.abdeckung.show')\r\n        ],\r\n    ],\r\n];\r\n\r\n// Same thing for other locales\r\n```\r\n\r\nYou can also check your model binding by doing this:\r\n\r\n```php\r\n$router->bind('firma', function($id) {\r\n    $record = \\App\\Firma::where('id', $id)->first();\r\n\r\n    dd($record); // This is only to see if everything is OK.\r\n\r\n    return $record;\r\n});\r\n```\r\n\r\nBonus : https://github.com/ARCANEDEV/Localization/issues/17"}}