@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | |
32 | 32 | // Set required paths |
33 | 33 | $this->dirs = ['base' => $this->settings['base_path'] ?? base_path()]; |
34 | - $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'] .'/'. config('thinktomorrow.chief.domain.path', 'src'); |
|
35 | - $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'] . '/resources/views'; |
|
34 | + $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'].'/'.config('thinktomorrow.chief.domain.path', 'src'); |
|
35 | + $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'].'/resources/views'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function handle() |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | private function publishModel() |
50 | 50 | { |
51 | 51 | $this->publishFile( |
52 | - __DIR__ . '/stubs/model.php.stub', |
|
53 | - $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
52 | + __DIR__.'/stubs/model.php.stub', |
|
53 | + $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
54 | 54 | 'model' |
55 | 55 | ); |
56 | 56 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | private function publishController() |
61 | 61 | { |
62 | 62 | $this->publishFile( |
63 | - __DIR__ . '/stubs/controller.php.stub', |
|
64 | - $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
63 | + __DIR__.'/stubs/controller.php.stub', |
|
64 | + $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
65 | 65 | 'controller' |
66 | 66 | ); |
67 | 67 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | protected function publishFile($from, $to, $type) |
77 | 77 | { |
78 | 78 | if ($this->filesystem->exists($to) && !$this->option('force')) { |
79 | - if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) { |
|
79 | + if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $to = str_replace($this->dirs['base'], '', realpath($to)); |
117 | 117 | |
118 | - $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>'); |
|
118 | + $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>'); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | protected function replacePlaceholders($content) |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | // We make an estimated guess based on the project name. At Think Tomorrow, we |
141 | 141 | // have a src folder which is PSR-4 namespaced by the project name itself. |
142 | - return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'. ucfirst($this->plural)); |
|
142 | + return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'.ucfirst($this->plural)); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | private function addToConfig($configKey, $value) |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | { |
158 | 158 | $content = file_get_contents($file); |
159 | 159 | |
160 | - if(strpos($key,'.') !== false) |
|
160 | + if (strpos($key, '.') !== false) |
|
161 | 161 | { |
162 | 162 | $key = explode('.', $key); |
163 | 163 | |
164 | 164 | $content = preg_replace('/([\'|"]'.$key[0].'[\'|"][ ]*=>[ ]*\[[^\]]*\][ |,|\n]*[\'|"]'.$key[1].'[\'|"][ ]*=>[ ]*\[)([^\]]*|.*[\'|"])/', "$1".$value[0], $content); |
165 | - }else{ |
|
165 | + }else { |
|
166 | 166 | $content = preg_replace('/[\'|"]'.$key.'[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content); |
167 | 167 | } |
168 | 168 |
@@ -162,7 +162,7 @@ |
||
162 | 162 | $key = explode('.', $key); |
163 | 163 | |
164 | 164 | $content = preg_replace('/([\'|"]'.$key[0].'[\'|"][ ]*=>[ ]*\[[^\]]*\][ |,|\n]*[\'|"]'.$key[1].'[\'|"][ ]*=>[ ]*\[)([^\]]*|.*[\'|"])/', "$1".$value[0], $content); |
165 | - }else{ |
|
165 | + } else{ |
|
166 | 166 | $content = preg_replace('/[\'|"]'.$key.'[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content); |
167 | 167 | } |
168 | 168 |