From cba267c1bd2c51d82c560624c02040551f6c208f Mon Sep 17 00:00:00 2001 From: root Date: Mon, 18 May 2020 11:29:14 +0300 Subject: [PATCH] fixed defaultAttributes generator --- src/Processor/RulesProcessor.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Processor/RulesProcessor.php b/src/Processor/RulesProcessor.php index 50b49b9..98f2ce3 100644 --- a/src/Processor/RulesProcessor.php +++ b/src/Processor/RulesProcessor.php @@ -92,10 +92,13 @@ public function process(EloquentModel $model, Config $config) $columnNamesDefault[$column->getName()] = $column->getDefault(); } + //dd('class is: '.get_class($model)); + //dd($columnNamesDefault); + if(strpos(get_class($model),'Base')!==false) { $rules = new PropertyModel('attributes'); $rules->setAccess('protected') - ->setValue(array_filter($columnNamesDefault)) + ->setValue(array_filter($columnNamesDefault,fn($el) =>$el !== null)) ->setDocBlock(new DocBlockModel('@var array')); $model->addProperty($rules); }