$this->line('Handling folder ' . $folder);
$iterator = Files::getDirectoryIterator($folder, true);
foreach ($iterator as $item) {
+ $this->line('Testing ' . $item);
/** @var $item \SplFileInfo */
if ($item->isFile() && $item->getExtension() == 'php') {
$class = PHP::instanciateClassInFile($item);
/**
* Run a SSH command.
*
- * @param string $command The SSH command that needs to be run
- * @param bool $beforeNotice Information for the user before the command is run
- * @param bool $afterNotice Information for the user after the command is run
+ * @param string $command The SSH command that needs to be run
+ * @param bool $beforeNotice Information for the user before the command is run
+ * @param bool $afterNotice Information for the user after the command is run
*
* @return mixed Command-line output
*/
public function executeProcess($command, $beforeNotice = false, $afterNotice = false)
{
- $this->echo('info', $beforeNotice ? ' '.$beforeNotice : $command);
+ $this->echo('info', $beforeNotice ? ' ' . $beforeNotice : $command);
$process = new Process($command, null, null, null, $this->option('timeout'), null);
$process->run(function ($type, $buffer) {
namespace Cubist\Backpack\app\Magic\Models;
-use Cubist\Backpack\app\Magic\Controllers\CubistMagicController;
use Cubist\Backpack\app\Magic\Fields\CubistMagicField;
use Illuminate\Database\Eloquent\Model;
use Cubist\Backpack\app\Magic\CubistMagicAttribute;
use Illuminate\Support\Facades\Route;
-use Backpack\CRUD;
use Illuminate\Support\Str;
class CubistMagicModelAbstract extends Model
*/
protected $_fields = [];
+ /**
+ * @var array
+ */
+ protected $_options = [];
+
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
+ $this->init();
+ }
+
+ public function init(){
+
+ }
+
+ public function getOption($key, $default = null)
+ {
+ if (isset($this->_options[$key])) {
+ return $this->_options[$key];
+ }
+ return $default;
}
/**
protected function _replaceInCode($stub, $dest)
{
$vars = ['CAMELNAME' => $this->getCamelName(),
- 'ROUTEURL' => $this->getAttribute('name'),
- 'SINGULAR' => $this->getAttribute('singular', $this->getAttribute('name')),
- 'PLURAL' => $this->getAttribute('plural', ''),
+ 'ROUTEURL' => $this->getOption('name'),
+ 'SINGULAR' => $this->getOption('singular', $this->getOption('name')),
+ 'PLURAL' => $this->getOption('plural', ''),
'MODELNAMESPACE' => __NAMESPACE__ . '\\' . get_class($this),
'FIELDS' => var_export($this->_fields, true)
];
public function getCamelName()
{
- return Str::camel($this->getAttribute('name'));
+ return Str::camel($this->getOption('name'));
}
}