From 08cb3e39f021996e93d65519c84f45915bb43174 Mon Sep 17 00:00:00 2001 From: Maras0830 Date: Thu, 14 Jun 2018 18:21:41 +0800 Subject: [PATCH] hotfix: model Generator can generate fillable. --- src/Prettus/Repository/Generators/ModelGenerator.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Prettus/Repository/Generators/ModelGenerator.php b/src/Prettus/Repository/Generators/ModelGenerator.php index 7eb65bc2..0d427700 100644 --- a/src/Prettus/Repository/Generators/ModelGenerator.php +++ b/src/Prettus/Repository/Generators/ModelGenerator.php @@ -78,13 +78,15 @@ public function getReplacements() */ public function getFillable() { + $this->fillable = $this->options['fillable']; + if (!$this->fillable) { return '[]'; } $results = '[' . PHP_EOL; - foreach ($this->getSchemaParser()->toArray() as $column => $value) { - $results .= "\t\t'{$column}'," . PHP_EOL; + foreach ($this->getSchemaParser() as $value) { + $results .= "\t\t'{$value}'," . PHP_EOL; } return $results . "\t" . ']'; @@ -97,6 +99,6 @@ public function getFillable() */ public function getSchemaParser() { - return new SchemaParser($this->fillable); + return explode(',', str_replace(' ', '', $this->fillable)); } }