Exemplo n.º 1
0
 /**
  * Entity constructor.
  *
  * @param array $attributes
  */
 public function __construct(array $attributes = [])
 {
     $position = $this->getPositionColumn();
     $depth = $this->getRealDepthColumn();
     $this->fillable(array_merge($this->getFillable(), [$position, $depth]));
     if (!isset($attributes[$depth])) {
         $attributes[$depth] = 0;
     }
     $this->closure = new $this->closure();
     // The default class name of the closure table was not changed
     // so we define and set default closure table name automagically.
     // This can prevent useless copy paste of closure table models.
     if (get_class($this->closure) == 'Franzose\\ClosureTable\\Models\\ClosureTable') {
         $table = $this->getTable() . '_closure';
         $this->closure->setTable($table);
     }
     parent::__construct($attributes);
 }