| @@ 5-44 (lines=40) @@ | ||
| 2 | ||
| 3 | namespace SleepingOwl\Admin\Console\Installation; |
|
| 4 | ||
| 5 | class CreateBootstrapDirectory extends Installator |
|
| 6 | { |
|
| 7 | public function showInfo() |
|
| 8 | { |
|
| 9 | $this->command->line('Creating bootstrap directory: <info>✔</info>'); |
|
| 10 | } |
|
| 11 | ||
| 12 | /** |
|
| 13 | * Install the components. |
|
| 14 | * |
|
| 15 | * @return void |
|
| 16 | */ |
|
| 17 | public function install() |
|
| 18 | { |
|
| 19 | $directory = $this->getDirectory(); |
|
| 20 | ||
| 21 | $this->command->files()->makeDirectory($directory, 0755, true, true); |
|
| 22 | ||
| 23 | $directoryPath = str_replace(base_path(), '', $directory); |
|
| 24 | $this->command->line("<info>Admin bootstrap directory is [{$directoryPath}]</info>"); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * При возврате методом true данный компонент будет пропущен. |
|
| 29 | * |
|
| 30 | * @return bool |
|
| 31 | */ |
|
| 32 | public function installed() |
|
| 33 | { |
|
| 34 | return is_dir($this->getDirectory()); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @return string |
|
| 39 | */ |
|
| 40 | protected function getDirectory() |
|
| 41 | { |
|
| 42 | return $this->config->get('bootstrapDirectory', app_path('Admin')); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 5-43 (lines=39) @@ | ||
| 2 | ||
| 3 | namespace SleepingOwl\Admin\Console\Installation; |
|
| 4 | ||
| 5 | class CreatePublicDirectory extends Installator |
|
| 6 | { |
|
| 7 | public function showInfo() |
|
| 8 | { |
|
| 9 | $this->command->line('Creating public directory: <info>✔</info>'); |
|
| 10 | } |
|
| 11 | ||
| 12 | /** |
|
| 13 | * Install the components. |
|
| 14 | * |
|
| 15 | * @return void |
|
| 16 | */ |
|
| 17 | public function install() |
|
| 18 | { |
|
| 19 | $directory = $this->getDirectory(); |
|
| 20 | ||
| 21 | $this->command->files()->makeDirectory($directory, 0755, true, true); |
|
| 22 | $directoryPath = str_replace(base_path(), '', $directory); |
|
| 23 | $this->command->line("<info>Public upload directory is [{$directoryPath}]</info>"); |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * При возврате методом true данный компонент будет пропущен. |
|
| 28 | * |
|
| 29 | * @return bool |
|
| 30 | */ |
|
| 31 | public function installed() |
|
| 32 | { |
|
| 33 | return is_dir($this->getDirectory()); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @return string |
|
| 38 | */ |
|
| 39 | protected function getDirectory() |
|
| 40 | { |
|
| 41 | return public_path('images/uploads'); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||