public function data($attribute, $value = null) { if (is_array($attribute)) { foreach ($attribute as $key => $val) { $this->setAttribute('data-' . $key, $val); } } else { $this->setAttribute('data-' . $attribute, $value); } return $this; }