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 7171 */
7272abstract class BaseElement implements Htmlable, HtmlElement
7373{
74- use Conditionable;
74+ use Conditionable {
75+ unless as trait_unless;
76+ }
7577
7678 use Macroable {
7779 __call as __macro_call;
@@ -388,13 +390,18 @@ public function if(bool $condition, \Closure $callback)
388390 * Conditionally transform the element. Note that since elements are
389391 * immutable, you'll need to return a new instance from the callback.
390392 *
391- * @param bool $condition
392- * @param \Closure $callback
393+ * @param mixed $condition
394+ * @param callable $callback
395+ * @param callable|null $default
393396 *
394397 * @return mixed
395398 */
396- public function unless (bool $ condition , \ Closure $ callback )
399+ public function unless ($ condition , callable $ callback, callable | null $ default = null )
397400 {
401+ if (! is_bool ($ condition ) || ! $ callback instanceof \Closure || ! is_null ($ default )) {
402+ return $ this ->trait_unless ($ condition , $ callback , $ default );
403+ }
404+
398405 return $ this ->if (! $ condition , $ callback );
399406 }
400407
You can’t perform that action at this time.
0 commit comments