File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 1515
1616abstract class BaseElement implements Htmlable, HtmlElement
1717{
18- use Conditionable;
18+ use Conditionable {
19+ unless as trait_unless;
20+ }
1921
2022 use Macroable {
2123 __call as __macro_call;
@@ -332,13 +334,18 @@ public function if(bool $condition, \Closure $callback)
332334 * Conditionally transform the element. Note that since elements are
333335 * immutable, you'll need to return a new instance from the callback.
334336 *
335- * @param bool $condition
336- * @param \Closure $callback
337+ * @param mixed $condition
338+ * @param callable $callback
339+ * @param callable|null $default
337340 *
338341 * @return mixed
339342 */
340- public function unless (bool $ condition , \ Closure $ callback )
343+ public function unless ($ condition , callable $ callback, callable | null $ default = null )
341344 {
345+ if (! is_bool ($ condition ) || ! $ callback instanceof \Closure || ! is_null ($ default )) {
346+ return $ this ->trait_unless ($ condition , $ callback , $ default );
347+ }
348+
342349 return $ this ->if (! $ condition , $ callback );
343350 }
344351
You can’t perform that action at this time.
0 commit comments