Skip to content

Commit 51967fa

Browse files
authored
Get attributes from within the json blob (#1)
1 parent 5967340 commit 51967fa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Entries/EntryModel.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Statamic\Eloquent\Entries;
44

55
use Illuminate\Database\Eloquent\Model as Eloquent;
6+
use Illuminate\Support\Arr;
67

78
class EntryModel extends Eloquent
89
{
@@ -21,6 +22,11 @@ public function origin()
2122
return $this->belongsTo(self::class);
2223
}
2324

25+
public function getAttribute($key)
26+
{
27+
return Arr::get($this->getAttributeValue('data'), $key, parent::getAttribute($key));
28+
}
29+
2430
public static function generateId()
2531
{
2632
return null;

0 commit comments

Comments
 (0)