Skip to content

Commit b08bbd6

Browse files
authored
Fix getWithout should always return array.
1 parent c892092 commit b08bbd6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Traits/ModelTrait.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,19 @@ protected function getWith(): array
104104
*/
105105
protected function getWithout(): array
106106
{
107-
return empty($this->without) ? [] : $this->without;
107+
// Ensure $this->without is set at all
108+
if (empty($this->without))
109+
{
110+
$this->without = [];
111+
}
112+
113+
// Force a single table name into an array
114+
if (! is_array($this->without))
115+
{
116+
$this->without = [$this->without];
117+
}
118+
119+
return $this->without;
108120
}
109121

110122
/**

0 commit comments

Comments
 (0)