{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/7865","labels_url":"https://api.github.com/repos/laravel/framework/issues/7865/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/7865/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/7865/events","html_url":"https://github.com/laravel/framework/issues/7865","id":59725136,"number":7865,"title":"(L5) Custom Route Bindings not working on production (but working in homestead)","user":{"login":"Someguy123","id":1267260,"avatar_url":"https://avatars.githubusercontent.com/u/1267260?v=3","gravatar_id":"","url":"https://api.github.com/users/Someguy123","html_url":"https://github.com/Someguy123","followers_url":"https://api.github.com/users/Someguy123/followers","following_url":"https://api.github.com/users/Someguy123/following{/other_user}","gists_url":"https://api.github.com/users/Someguy123/gists{/gist_id}","starred_url":"https://api.github.com/users/Someguy123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Someguy123/subscriptions","organizations_url":"https://api.github.com/users/Someguy123/orgs","repos_url":"https://api.github.com/users/Someguy123/repos","events_url":"https://api.github.com/users/Someguy123/events{/privacy}","received_events_url":"https://api.github.com/users/Someguy123/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-03-03T23:30:57Z","updated_at":"2015-11-26T13:55:05Z","closed_at":"2015-03-04T20:47:31Z","body":"I've ran into a very strange issue, I've written custom bindings for resolving users and images, which works great on my homestead setup, i.e. `/users/someguy123`, but on my production system, that same URL doesn't work, instead it appears to fallback to something that acts like `Route::model`, `/users/1` will work, but `/users/someguy123` will not.\r\n\r\n**The code**\r\n\r\nroutes.php\r\n\r\n    // use a function which simply does dd($user);\r\n    Route::get('/users/{user}', 'ProfileController@show');\r\n    Route::bind('user', function($value)\r\n    {\r\n\t    return \\App\\User::where('username', $value)->firstOrFail();\r\n    });\r\n\r\nRouteServiceProvider.php\r\n\r\n    public function boot(Router $router)\r\n\t{\r\n\t\tparent::boot($router);\r\n\t\t$router->model('user', 'App\\User');\r\n\t}\r\n\r\n\r\n**The systems**\r\n\r\nIt **works on my Laravel Homestead** vagrant box running on my Macbook. I can access `/users/someguy123` and it will show that user in the database.\r\n\r\n    vagrant@homestead:~$ php -v\r\n    PHP 5.6.3-1+deb.sury.org~trusty+1 (cli) (built: Nov 19 2014 19:38:33)\r\n    Copyright (c) 1997-2014 The PHP Group\r\n    Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies\r\n        with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies\r\n        with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans\r\n\r\n    vagrant@homestead:~$ cat /etc/lsb-release\r\n    DISTRIB_ID=Ubuntu\r\n    DISTRIB_RELEASE=14.04\r\n    DISTRIB_CODENAME=trusty\r\n    DISTRIB_DESCRIPTION=\"Ubuntu 14.04.1 LTS\"\r\n\r\nIt **does NOT work** on my DigitalOcean Ubuntu box, accessing `/users/someguy123` causes a 404 error, where-as `/users/1` works fine (assuming 1 exists in the DB). I have used `php artisan clear-compiled`, I've manually destroyed the `/storage` folder multiple times, I've ran `composer dump-autoload`, all of my composer packages are up to date.\r\n\r\n    root@x:~# php -v\r\n    PHP 5.5.9-1ubuntu4.6 (cli) (built: Feb 13 2015 19:17:11)\r\n    Copyright (c) 1997-2014 The PHP Group\r\n    Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies\r\n        with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies\r\n\r\n    root@x:~# cat /etc/lsb-release\r\n    DISTRIB_ID=Ubuntu\r\n    DISTRIB_RELEASE=14.04\r\n    DISTRIB_CODENAME=trusty\r\n    DISTRIB_DESCRIPTION=\"Ubuntu 14.04.2 LTS\"\r\n\r\nI've inspected the router within tinker and can confirm the bindings are definitely getting registered in the router, but I can't figure much else out other than that\r\n\r\n    => <Illuminate\\Routing\\Router #00000000323694840000000010af4aae> {\r\n       binders: [\r\n           \"user\"  => function ($value) use ($class, $callback) { ... },\r\n           \"images\" => function ($value) use ($class, $callback) { ... }\r\n       ],\r\n       verbs: [\r\n           \"GET\",\r\n           \"HEAD\",\r\n           \"POST\",\r\n           \"PUT\",\r\n           \"PATCH\",\r\n           \"DELETE\",\r\n           \"OPTIONS\"\r\n       ]\r\n     }\r\n\r\nAny help on this would be appreciated."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/159921602","html_url":"https://github.com/laravel/framework/issues/7865#issuecomment-159921602","issue_url":"https://api.github.com/repos/laravel/framework/issues/7865","id":159921602,"user":{"login":"iateadonut","id":1443928,"avatar_url":"https://avatars.githubusercontent.com/u/1443928?v=3","gravatar_id":"","url":"https://api.github.com/users/iateadonut","html_url":"https://github.com/iateadonut","followers_url":"https://api.github.com/users/iateadonut/followers","following_url":"https://api.github.com/users/iateadonut/following{/other_user}","gists_url":"https://api.github.com/users/iateadonut/gists{/gist_id}","starred_url":"https://api.github.com/users/iateadonut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iateadonut/subscriptions","organizations_url":"https://api.github.com/users/iateadonut/orgs","repos_url":"https://api.github.com/users/iateadonut/repos","events_url":"https://api.github.com/users/iateadonut/events{/privacy}","received_events_url":"https://api.github.com/users/iateadonut/received_events","type":"User","site_admin":false},"created_at":"2015-11-26T13:55:05Z","updated_at":"2015-11-26T13:55:05Z","body":"This worked for us:\r\n\r\n`php artisan clear-compiled`"}}