Skip to content

Commit 05846e7

Browse files
committed
formatting
1 parent 156773c commit 05846e7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Illuminate/Database/Eloquent/Casts/AsArrayObject.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public static function castUsing(array $arguments)
1919
{
2020
public function get($model, $key, $value, $attributes)
2121
{
22+
if (! isset($attributes[$key])) {
23+
return;
24+
}
25+
2226
$data = json_decode($attributes[$key], true);
2327

2428
return is_array($data) ? new ArrayObject($data) : null;

src/Illuminate/Database/Eloquent/Casts/AsCollection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ public static function castUsing(array $arguments)
2020
{
2121
public function get($model, $key, $value, $attributes)
2222
{
23+
if (! isset($attributes[$key])) {
24+
return;
25+
}
26+
2327
$data = json_decode($attributes[$key], true);
2428

2529
return is_array($data) ? new Collection($data) : null;

0 commit comments

Comments
 (0)