Skip to content

Commit

Permalink
fixed defaultAttributes generator
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 18, 2020
1 parent 2bca9ff commit cba267c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Processor/RulesProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit cba267c

Please sign in to comment.