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 Request] Add updateOrCreate/firstOrCreate #1833

Open
2 tasks done
vesper8 opened this issue May 6, 2024 · 0 comments
Open
2 tasks done

[Feature Request] Add updateOrCreate/firstOrCreate #1833

vesper8 opened this issue May 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@vesper8
Copy link

vesper8 commented May 6, 2024

Describe the feature

These are some of the most-used eloquent helpers in Laravel, I personally use updateOrCreate a lot and it would be nice to have it in pinia-orm so I don't have to do things like this:

        if (useRepo(Requirement).find(id)) {
          await useRepo(Requirement)
            .whereId(id) //
            .update(this.form);
        } else {
          await useRepo(Requirement).save({
            id: useRepo(Requirement).all().length + 1, //
            ...this.form,
          });
        }

Additional information

  • Would you be willing to help implement this feature?

Final checks

@CodeDredd CodeDredd added enhancement New feature or request and removed pending triage labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants