03.12.2015 Views

laravel4cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Deployment 79<br />

1 protected function getHost()<br />

2 {<br />

3 return gethostname();<br />

4 }<br />

5<br />

6 protected function getEnvironment()<br />

7 {<br />

8 return App::environment();<br />

9 }<br />

.<br />

This was extracted from app/commands/EnvironmentCommand.php.<br />

The gethostname() function returns the name of the machine on which it is invoked. Similarly; the<br />

App::environment() method returns the name of the environment in which Laravel is being run.<br />

After registering and running this command, I see the following:<br />

1 php artisan environment:get<br />

2 Host: formativ.local<br />

3 Environment: local<br />

Setting Environments<br />

The next command is going to allow us to alter these values from the command line (without<br />

changing hard-coded values)…<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!