03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Deployment 80<br />

14 public function fire()<br />

15 {<br />

16 $host = $this->getHost();<br />

17 $config = $this->getConfig();<br />

18 $overwrite = $this->option("host");<br />

19 $environment = $this->argument("environment");<br />

20<br />

21 if (!isset($config[$environment]))<br />

22 {<br />

23 $config[$environment] = [];<br />

24 }<br />

25<br />

26 $use = $host;<br />

27<br />

28 if ($overwrite)<br />

29 {<br />

30 $use = $overwrite;<br />

31 }<br />

32<br />

33 if (!in_array($use, $config[$environment]))<br />

34 {<br />

35 $config[$environment][] = $use;<br />

36 }<br />

37<br />

38 $this->setConfig($config);<br />

39<br />

40 $this->line(trim("<br />

41 Added<br />

42 " . $use . "<br />

43 to<br />

44 " . $environment . "<br />

45 environment.<br />

46 "));<br />

47 }<br />

48<br />

49 protected function getArguments()<br />

50 {<br />

51 return [<br />

52 [<br />

53 "environment",<br />

54 InputArgument::REQUIRED,<br />

55 "Environment to add the host to."

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

Saved successfully!

Ooh no, something went wrong!