Add disable write magic methods on models (#466)

* Add desable write magic methods on models

* Fix property name

* Opps commit

* Fix

* Change default parameter of property
This commit is contained in:
Ivan Boldyrev
2017-03-16 11:46:50 +01:00
committed by Barry vd. Heuvel
parent b611cb5eff
commit 144a50e8ee
2 changed files with 20 additions and 5 deletions
+9 -5
View File
@@ -50,6 +50,7 @@ class ModelsCommand extends Command
*/
protected $description = 'Generate autocompletion for models';
protected $write_model_magic_where;
protected $properties = array();
protected $methods = array();
protected $write = false;
@@ -81,6 +82,7 @@ class ModelsCommand extends Command
$model = $this->argument('model');
$ignore = $this->option('ignore');
$this->reset = $this->option('reset');
$this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true);
//If filename is default and Write is not specified, ask what to do
if (!$this->write && $filename === $this->filename && !$this->option('nowrite')) {
@@ -362,11 +364,13 @@ class ModelsCommand extends Command
$comment = $column->getComment();
$this->setProperty($name, $type, true, true, $comment);
$this->setMethod(
Str::camel("where_" . $name),
'\Illuminate\Database\Query\Builder|\\' . get_class($model),
array('$value')
);
if ($this->write_model_magic_where) {
$this->setMethod(
Str::camel("where_" . $name),
'\Illuminate\Database\Query\Builder|\\' . get_class($model),
array('$value')
);
}
}
}
}