/** * Dynamically call methods * @param string $method * @param array $params * @throws LaravelExcelException * @return LaravelExcelWriter */ public function __call($method, $params) { // If the dynamic call starts with "set" if (starts_with($method, 'set') && $this->excel->isChangeableProperty($method)) { $this->_setAttribute($method, $params); return $this; } elseif (method_exists($this->excel, $method)) { // Call the method from the excel object with the given params $return = call_user_func_array(array($this->excel, $method), $params); return $return ? $return : $this; } throw new LaravelExcelException('[ERROR] Writer method [' . $method . '] does not exist.'); }