From 9ed9488026964ed2a579b9c3b26ded49fe6cd386 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 22 May 2019 19:17:33 +0200 Subject: [PATCH] #2783 --- src/app/Console/Commands/MagicCubistCommand.php | 2 +- src/app/Magic/Models/CubistMagicModelAbstract.php | 9 +++++++-- src/resources/cubistmagic/Controller.stub | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/Console/Commands/MagicCubistCommand.php b/src/app/Console/Commands/MagicCubistCommand.php index 434b91c..d7afaf9 100644 --- a/src/app/Console/Commands/MagicCubistCommand.php +++ b/src/app/Console/Commands/MagicCubistCommand.php @@ -75,7 +75,7 @@ class MagicCubistCommand extends Command { $this->echo('info', $beforeNotice ? ' ' . $beforeNotice : $command); - $process = new Process($command, null, null, null, $this->option('timeout'), null); + $process = new Process($command, null, null, null, 50, null); $process->run(function ($type, $buffer) { if (Process::ERR === $type) { $this->echo('comment', $buffer); diff --git a/src/app/Magic/Models/CubistMagicModelAbstract.php b/src/app/Magic/Models/CubistMagicModelAbstract.php index 170a36c..03944a4 100644 --- a/src/app/Magic/Models/CubistMagicModelAbstract.php +++ b/src/app/Magic/Models/CubistMagicModelAbstract.php @@ -30,7 +30,8 @@ class CubistMagicModelAbstract extends Model $this->init(); } - public function init(){ + public function init() + { } @@ -72,7 +73,7 @@ class CubistMagicModelAbstract extends Model protected function _generateControllerCode() { $this->_replaceInCode($this->_getStubPath() . 'Controller.stub', - app_path() . '/Http/Controllers/' . $this->getCamelName() . 'CubistMagicController.php'); + app_path() . '/Http/Controllers/Admin/CubistMagic/' . $this->getCamelName() . 'CubistMagicController.php'); } @@ -91,6 +92,10 @@ class CubistMagicModelAbstract extends Model $res = str_replace('_' . $name . '_', $value, $res); } + if (!file_exists(dirname($dest))) { + mkdir(dirname($dest), 0777, true); + } + file_put_contents($dest, $res); } diff --git a/src/resources/cubistmagic/Controller.stub b/src/resources/cubistmagic/Controller.stub index 2d5deb3..e11f610 100644 --- a/src/resources/cubistmagic/Controller.stub +++ b/src/resources/cubistmagic/Controller.stub @@ -1,6 +1,6 @@