How to use laravel-nova - 10 common examples

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 swisnl / laravel-nova-mirror / resources / js / components / CardWrapper.vue View on Github external
function calculateCardWidth(card) {
    // If the card's width is found in the accepted sizes return that class,
    // or return the default 1/3 class
    return CardSizes.indexOf(card.width) !== -1 ? `w-${card.width}` : 'w-1/3'
}
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 / components / Medialibrary / Resource / Request.vue View on Github external
async created () {
        this.$emit('started')

        try {
            this.response = await Minimum(this.request(), 200)
        } catch (error) {
            this.$emit('failed', error)
        }

        this.$emit('finished')
    },
github swisnl / laravel-nova-mirror / resources / js / components / ImageLoader.vue View on Github external
mounted() {
        Minimum(
            Nova.request().get(this.src, {
                responseType: 'blob',
            })
        )
            .then(({ headers, data }) => {
                const blob = new Blob([data], { type: headers['content-type'] })
                let newImage = new Image()
                newImage.src = window.URL.createObjectURL(blob)
                newImage.className = 'block w-full'
                newImage.draggable = false
                this.$refs.card.$el.appendChild(newImage)
                this.loading = false
            })
            .catch(error => {
                this.missing = true
                this.$emit('missing', true)
github swisnl / laravel-nova-mirror / resources / js / views / Detail.vue View on Github external
getResource() {
            this.resource = null

            return Minimum(
                Nova.request().get('/nova-api/' + this.resourceName + '/' + this.resourceId)
            )
                .then(({ data: { panels, resource } }) => {
                    this.panels = panels
                    this.resource = resource
                    this.loading = false
                })
                .catch(error => {
                    if (error.response.status >= 500) {
                        Nova.$emit('error', error.response.data.message)
                        return
                    }

                    if (error.response.status === 404 && this.initialLoading) {
                        this.$router.push({ name: '404' })
                        return
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)
                    }
                })
        },

laravel-nova

Supporting modules for Laravel Nova

MIT
Latest version published 4 years ago

Package Health Score

42 / 100
Full package analysis