diff --git a/src/Illuminate/Conditionable/Traits/Conditionable.php b/src/Illuminate/Conditionable/Traits/Conditionable.php index aa77df52759b..e0d58b9660d6 100644 --- a/src/Illuminate/Conditionable/Traits/Conditionable.php +++ b/src/Illuminate/Conditionable/Traits/Conditionable.php @@ -26,9 +26,9 @@ public function when($value, callable $callback = null, callable $default = null } if ($value) { - return $callback($this, $value) ?: $this; + return $callback($this, $value) ?? $this; } elseif ($default) { - return $default($this, $value) ?: $this; + return $default($this, $value) ?? $this; } return $this; @@ -53,9 +53,9 @@ public function unless($value, callable $callback = null, callable $default = nu } if (! $value) { - return $callback($this, $value) ?: $this; + return $callback($this, $value) ?? $this; } elseif ($default) { - return $default($this, $value) ?: $this; + return $default($this, $value) ?? $this; } return $this;