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

Feature: Ability to edit primary key #268

Closed
richstandbrook opened this issue Aug 28, 2018 · 7 comments
Closed

Feature: Ability to edit primary key #268

richstandbrook opened this issue Aug 28, 2018 · 7 comments

Comments

@richstandbrook
Copy link

I have a model that has a unique string as the primary key. I'd like to be able to edit it in Nova, but it seems Nova just hides the primary key from the form with no override I can find.

@richstandbrook richstandbrook changed the title Ability to edit primary key Feature: Ability to edit primary key Aug 28, 2018
@David-Griffiths
Copy link

I first thought you could override the query with editQuery() the same way as indexQuery(), but the former doesn't exist.

Try exploring global scopes on the main Laravel model to select id as custom_id, then use that.

@davidhemphill
Copy link
Contributor

Just use a Text field?

@richstandbrook
Copy link
Author

@davidhemphill I add Text::make('ID'), and it shows on the list view and the details view but it's still left off the form view, so I can't edit it.

@fbingha
Copy link

fbingha commented Nov 27, 2018

More importantly, not sure of use cases where the primary key is editable but there are cases where I need to be able to define the primary key when creating an element. At this time, the primary key field is not shown on the create form.

@christopherarter
Copy link

@davidhemphill Can this issue be re-opened? @fbingha described exactly the situation I'm in as well. The Text field does not work.

@davidhemphill
Copy link
Contributor

Ok, you're right it doesn't show. I've added this though and it will be available in the next release. 👍

@nikans
Copy link

nikans commented Mar 20, 2021

I've created a custom text field, so you can edit your ID fields or link a title field on the index screen.

https://github.com/nikans/text-linked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants