Setting up the Laravel Environment

Laravel, 2015-06-16 23:07:21 UTC

You must make a lot of changes to the application that you created. The application can be uploaded to the server via FTP or git pull. By creating an environment setting works, you don't need more time manually setting either on a local or online server. By creating an environment setting, the application decides themselves where they run now and run related settings.

You can easily setting up the Laravel environment by these way;

1. Open /bootstrap/start.php

$env = $app->detectEnvironment(array(
    'local' => array('your_local_virtual_domain_name','other_name'),
    'production' => array('your_site.com')
));


2. Then you must create 2 folder based on detectEnvironment array;

2.1. /app/config/local
Then you can copy all file in /app/config folder into /app/config/local
The example below will give an error in local computer;
Open file /app/config/local/app.php, then edit into this

'debug' => true,
'url' => 'http://your_local_virtual_domain_name',



2.2. /app/config/production
The example below will not showing an error in online server or production server;

'debug' => false,
'url' => 'http://your_site.com',

Sumber: http://www.develbook.com/2015/02/setting-laravel-environment.html

 


Share: