/** * Pivot constructor. * @param \Notadd\Foundation\Database\Eloquent\Model $parent * @param string $attributes * @param string $table * @param bool $exists */ public function __construct(Model $parent, $attributes, $table, $exists = false) { parent::__construct(); $this->setTable($table); $this->setConnection($parent->getConnectionName()); $this->forceFill($attributes); $this->syncOriginal(); $this->parent = $parent; $this->exists = $exists; $this->timestamps = $this->hasTimestampAttributes(); }