/** * Share view with all sheets * @param string $view * @param array $data * @param array $mergeData * @return LaravelExcelWriter */ public function shareView($view, $data = array(), $mergeData = array()) { // Get the parser $this->getParser(); // Set the view inside the parser $this->parser->setView($view); $this->parser->setData($data); $this->parser->setMergeData($mergeData); return $this; }
/** * Add vars to the data array * @param string $key * @param bool|string $value * @param null $nullValue * @param bool|string $startCell * @param bool $strictNullComparison * @throws PHPExcel_Exception * @return void|$this */ protected function _addVars($key, $value = false, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) { // Add array of data if (is_array($key) || $key instanceof Collection) { // Set the data $this->data = $this->addData($key); // Create excel from array without a view if (!$this->parser) { return $this->createSheetFromArray($this->data, $nullValue, $startCell, $strictNullComparison); } } else { $this->data[$key] = $value; } // Set data to parser if ($this->parser) { $this->parser->setData($this->data); } }