Skip to content

Commit cf4b36c

Browse files
authored
Fix deprecated usage of passing null to array_key_exists in AsPivot class (#58073)
1 parent 975651f commit cf4b36c

File tree

1 file changed

+2
-1
lines changed
  • src/Illuminate/Database/Eloquent/Relations/Concerns

1 file changed

+2
-1
lines changed

src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ public function setRelatedModel(?Model $related = null)
242242
*/
243243
public function hasTimestampAttributes($attributes = null)
244244
{
245-
return array_key_exists($this->getCreatedAtColumn(), $attributes ?? $this->attributes);
245+
return ($createdAt = $this->getCreatedAtColumn()) !== null
246+
&& array_key_exists($createdAt, $attributes ?? $this->attributes);
246247
}
247248

248249
/**

0 commit comments

Comments
 (0)