Skip to content
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

Closed
MitchellMcKenna opened this issue Feb 11, 2019 · 4 comments
Closed

belongsTo field writes wrong attribute value on save #1342

MitchellMcKenna opened this issue Feb 11, 2019 · 4 comments
Assignees
Labels
bug Verified bug by the Nova team

Comments

@MitchellMcKenna
Copy link

  • 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 Verified bug by the Nova team label Feb 12, 2019
@dkulyk
Copy link

dkulyk commented Feb 14, 2019

PR has been sent to upstream

@hjelmdal
Copy link

What is the status of this? I really need this to function :-)

@dkulyk
Copy link

dkulyk commented Apr 4, 2019

This has been fixed and will be included in the next release.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Verified bug by the Nova team
Projects
None yet
Development

No branches or pull requests

3 participants