Set A Different public_path for Laravel applications on Webfaction

In a previous post, we had covered the issue how to get a Laravel application running on Webfaction.
While the approach worked well enough, the idea of symlinking to the ‘public’ directory was not a good one as every newly created file would have to be symlinked to make it available in the ‘webapps/appname’ folder. An Envoy task could easily accomplish this, but it just won’t scale on any website that has user uploaded files that has to be shown on the site.
Thankfully, Laravel provides an easy fix to this, which is to use the IoC container to bind the value of of public_path() to a different location. Since we don’t have this problem on the local setup, it is also a good idea to throw in environment detection into the mix.
All you have to do is open your bindings.php file (saved as app/bindings.php and included from app/start/global.php) and add the following lines:
if (\App::environment(‘production’))
\App::bind(‘path.public’, function()
return ‘/home/{{username}}/webapps/{{appname}}’;

Never mind.