How to use the laravel-nova.Errors function in laravel-nova

To help you get started, we’ve selected a few laravel-nova examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github runlinenl / nova-profile-tool / resources / js / components / Tool.vue View on Github external
const response = await this.createRequest()
                    this.loading = false

                    this.$toasted.show(
                        this.__('Your profile has been saved!'),
                        { type: 'success' }
                    )

                    // Reset the form by refetching the fields
                    this.getFields()

                    this.validationErrors = new Errors()
                } catch (error) {
                    this.loading = false
                    if (error.response.status == 422) {
                        this.validationErrors = new Errors(error.response.data.errors)
                    }
                }
            },
github swisnl / laravel-nova-mirror / resources / js / views / Create.vue View on Github external
try {
                const response = await this.createRequest()

                this.submittedViaCreateAndAddAnother = false

                this.$toasted.show(
                    this.__('The :resource was created!', {
                        resource: this.resourceInformation.singularLabel.toLowerCase(),
                    }),
                    { type: 'success' }
                )

                // Reset the form by refetching the fields
                this.getFields()

                this.validationErrors = new Errors()
            } catch (error) {
                this.submittedViaCreateAndAddAnother = false

                if (error.response.status == 422) {
                    this.validationErrors = new Errors(error.response.data.errors)
                }
            }
        },
github yassipad / laravel-nova-nested-form / resources / js / components / CustomFields / FileField.vue View on Github external
const attribute = this.field.originalAttribute

      const uri = this.viaRelationship
        ? `/nova-api/${resourceName}/${resourceId}/${relatedResourceName}/${relatedResourceId}/field/${attribute}?viaRelationship=${viaRelationship}`
        : `/nova-api/${resourceName}/${resourceId}/field/${attribute}`

      try {
        await Nova.request().delete(uri)
        this.closeRemoveModal()
        this.deleted = true
        this.$emit('file-deleted')
      } catch (error) {
        this.closeRemoveModal()
        if (error.response.status == 422) {
          this.uploadErrors = new Errors(error.response.data.errors)
        }
      }
    }
  }
github swisnl / laravel-nova-mirror / resources / js / components / Form / FileField.vue View on Github external
const attribute = this.field.attribute

            const uri = this.viaRelationship
                ? `/nova-api/${resourceName}/${resourceId}/${relatedResourceName}/${relatedResourceId}/field/${attribute}?viaRelationship=${viaRelationship}`
                : `/nova-api/${resourceName}/${resourceId}/field/${attribute}`

            try {
                await Nova.request().delete(uri)
                this.closeRemoveModal()
                this.deleted = true
                this.$emit('file-deleted')
            } catch (error) {
                this.closeRemoveModal()

                if (error.response.status == 422) {
                    this.uploadErrors = new Errors(error.response.data.errors)
                }
            }
        },
    },
github dmitrybubyakin / nova-medialibrary-field / resources / js / mixins / Resource / Update.js View on Github external
handleUpdateRequestError ({ response }) {
            if (response.status === 422) {
                this.validationErrors = new Errors(response.data.errors)
            } else if (response.status === 409) {
                this.error('Another user has updated this resource since this page was loaded. Please refresh the page and try again.')
            } else {
                this.requestFailed({ response } )
            }
        }
    }
github swisnl / laravel-nova-mirror / resources / js / components / ActionSelector.vue View on Github external
.catch(error => {
                    this.working = false

                    if (error.response.status == 422) {
                        this.errors = new Errors(error.response.data.errors)
                    }
                })
        },
github dmitrybubyakin / nova-medialibrary-field / resources / js / components / Medialibrary / Media.js View on Github external
try {
      await this.withUpdating(
        Nova
          .request()
          .post(`/nova-api/${this.resourceName}/${this.resourceId}`, formData),
      )

      this.closeAllModals()
      this.refresh()

      Nova.success(Nova.app.__('Media was updated!', { resource: this.singularLabel.toLowerCase() }))
    } catch (error) {
      if (!error.response) {
        throw error
      } else if (error.response.status === 422) {
        this.__errors = new Errors(error.response.data.errors)
      }

      Nova.error(Nova.app.__('There was a problem submitting the form.'))
    }
  }
github swisnl / laravel-nova-mirror / resources / js / views / Attach.vue View on Github external
resetErrors() {
            this.validationErrors = new Errors()
        },
github swisnl / laravel-nova-mirror / resources / js / views / Create.vue View on Github external
}),
                    { type: 'success' }
                )

                this.$router.push({
                    name: 'detail',
                    params: {
                        resourceName: this.resourceName,
                        resourceId: response.data.id,
                    },
                })
            } catch (error) {
                this.submittedViaCreateResource = false

                if (error.response.status == 422) {
                    this.validationErrors = new Errors(error.response.data.errors)
                }
            }
        },
github yassipad / laravel-nova-nested-form / resources / js / components / CustomFields / FileField.vue View on Github external
async removeFile() {
      this.uploadErrors = new Errors()

      const {
        resourceName,
        resourceId,
        relatedResourceName,
        relatedResourceId,
        viaRelationship
      } = this

      const attribute = this.field.originalAttribute

      const uri = this.viaRelationship
        ? `/nova-api/${resourceName}/${resourceId}/${relatedResourceName}/${relatedResourceId}/field/${attribute}?viaRelationship=${viaRelationship}`
        : `/nova-api/${resourceName}/${resourceId}/field/${attribute}`

      try {

laravel-nova

Supporting modules for Laravel Nova

MIT
Latest version published 4 years ago

Package Health Score

42 / 100
Full package analysis