RonnyKnoxville
RonnyKnoxville

Reputation: 6394

Laravel Nova: bypass accessor to getOriginal

When using Laravel Nova you may expect $this->getOriginal('name') to bypass an accessor to return the database value of name. However, this is not the case.

Text::make('Name')
    ->resolveUsing(function(){
        return $this->getOriginal('name')
    });

// Returns value provided by accessor

Upvotes: 1

Views: 467

Answers (1)

RonnyKnoxville
RonnyKnoxville

Reputation: 6394

To access the actual original property use getRawOriginal()

Text::make('Name')
    ->resolveUsing(function(){
        return $this->getRawOriginal('name')
    });

// Returns value from database

Upvotes: 4

Related Questions