Skip to content

[Feature Request] Add updateOrCreate/firstOrCreate #1833

Description

@vesper8

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions