Skip to content

Commit 8757a1d

Browse files
committed
Use getRawOriginal when available to counter Laravel 7 getOriginal change
1 parent c5aa9f3 commit 8757a1d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Controllers/ModelController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ public function show($slug, $id)
133133
{
134134
$this->checkSlug($slug, 'read');
135135
// Get the original values and not the altered values from model accessors
136-
$row = @$this->model()::findOrFail($id, $this->filter_pivot($this->columns()))->getOriginal();
136+
if (method_exists(@$this->model(), 'getRawOriginal')) {
137+
$row = @$this->model()::findOrFail($id, $this->filter_pivot($this->columns()))->getRawOriginal();
138+
} else {
139+
$row = @$this->model()::findOrFail($id, $this->filter_pivot($this->columns()))->getOriginal();
140+
}
137141
foreach ($this->columns() as $columnId => $column) {
138142
// Output array columns with JSON_PRETTY_PRINT
139143
if ($column['type'] == 'array') {

0 commit comments

Comments
 (0)