@@ -91,6 +91,13 @@ abstract class BaseComponent implements Htmlable
9191 */
9292 protected $ inlineValidation = true ;
9393
94+ /**
95+ * The key to be used for the view error bag.
96+ *
97+ * @var string
98+ */
99+ protected $ errorBag = 'default ' ;
100+
94101 /**
95102 * Set resource name property.
96103 *
@@ -104,8 +111,8 @@ public function __construct($resource)
104111 /**
105112 * Initialized the input arguments.
106113 *
107- * @param null $name
108- * @param null $value
114+ * @param null $name
115+ * @param null $value
109116 * @return $this
110117 */
111118 abstract public function init ();
@@ -166,6 +173,19 @@ public function name($name)
166173 return $ this ;
167174 }
168175
176+ /**
177+ * The key to be used for the view error bag.
178+ *
179+ * @param string $bag
180+ * @return $this
181+ */
182+ public function errorBag ($ bag = 'default ' )
183+ {
184+ $ this ->errorBag = $ bag ;
185+
186+ return $ this ;
187+ }
188+
169189 /**
170190 * @param $label
171191 * @return $this
@@ -225,8 +245,8 @@ public function autofocus($autofocus = true)
225245 /**
226246 * Add custom attribute.
227247 *
228- * @param string|array $key
229- * @param null $value
248+ * @param string|array $key
249+ * @param null $value
230250 * @return $this
231251 */
232252 public function attribute ($ key , $ value = null )
@@ -272,7 +292,7 @@ public function style($style)
272292 /**
273293 * Set the input inline validation errors option.
274294 *
275- * @param bool $bool
295+ * @param bool $bool
276296 * @return $this
277297 */
278298 public function inlineValidation ($ bool = true )
@@ -297,6 +317,7 @@ protected function render()
297317 'note ' => $ this ->note ,
298318 'attributes ' => $ this ->attributes ,
299319 'inlineValidation ' => $ this ->inlineValidation ,
320+ 'errorBag ' => $ this ->errorBag ,
300321 ], $ this ->viewComposer ());
301322
302323 return view ($ this ->getViewPath ())
@@ -317,7 +338,7 @@ protected function viewComposer()
317338 /**
318339 * Transform the properties to be used in view.
319340 *
320- * @param array $properties
341+ * @param array $properties
321342 * @return array
322343 */
323344 protected function transformProperties (array $ properties )
@@ -334,4 +355,4 @@ public function toHtml()
334355 {
335356 return $ this ->render ();
336357 }
337- }
358+ }
0 commit comments