New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

belongsTo field writes wrong attribute value on save #1342

Open
MitchellMcKenna opened this Issue Feb 11, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@MitchellMcKenna
Copy link

MitchellMcKenna commented Feb 11, 2019

  • Laravel Version: 5.7.22
  • Nova Version: 1.3.1

Description:

belongsTo is writing the id of the resource to the column instead of the value of the attribute defined as the ownerKey in the model's belongsTo relationship (in example below the ownerKey is set as code).

Steps To Reproduce:

// app/Company.php (Model)
public function industry()
{
    return $this->belongsTo(Industry::class, 'industry', 'code');
}
// app/Nova/Company.php (Nova Resource)
public function fields(Request $request)
{
    return [
        BelongsTo::make('Industry', 'industry', Industry::class)->searchable(),

@dkulyk dkulyk self-assigned this Feb 12, 2019

@dkulyk dkulyk added the bug label Feb 12, 2019

@dkulyk

This comment has been minimized.

Copy link
Collaborator

dkulyk commented Feb 14, 2019

PR has been sent to upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment