Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup different public path in laravel 4 for testing environment

Tags:

php

laravel

I have set up a test environment in start.php:

$env = $app->detectEnvironment(array(
    'local' => array('http://localhost*', '*.dev'),
));

Now I want to define a different public path for local environment

production: 'public' => DIR.'/../../../www/',

local: 'public' => DIR.'/../../../www/local',

but the paths.php locates in bootstrap folder instead of app, so how can I set up a different public path?

like image 493
JackpotK Avatar asked Sep 19 '25 18:09

JackpotK


1 Answers

you have access to the $env variable in your paths.php (since it just gets included from start.php). so you can build in a switch:

'public' => ($env == 'local') ? __DIR__.'/../public' : __DIR__ . '/some/where/else/public',

works for me in production.

like image 75
passioncoder Avatar answered Sep 21 '25 09:09

passioncoder