https://github.com/val-bubbleflat/laravel-vue-validator
Simple package to display error in vue from laravel validation
https://github.com/val-bubbleflat/laravel-vue-validator
laravel laravel-validation validation validation-library vue vuejs
Last synced: about 2 months ago
JSON representation
Simple package to display error in vue from laravel validation
- Host: GitHub
- URL: https://github.com/val-bubbleflat/laravel-vue-validator
- Owner: val-bubbleflat
- License: mit
- Created: 2017-06-25T12:08:23.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-11T06:26:09.000Z (over 6 years ago)
- Last Synced: 2025-07-16T23:47:07.207Z (5 months ago)
- Topics: laravel, laravel-validation, validation, validation-library, vue, vuejs
- Language: JavaScript
- Size: 7.81 KB
- Stars: 31
- Watchers: 4
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-vue - laravel-vue-validator - Simple package to display error in vue from laravel validation ` 📝 3 years ago` (UI Utilities [🔝](#readme))
- awesome-vue-zh - laravel-Vue验证器 - 显示laravel验证规则中的错误 (UI实用程序 / 形成)
- awesome-vue - laravel-vue-validator - Display errors from laravel validation rules (Components & Libraries / UI Utilities)
- awesome-vue - laravel-vue-validator ★22 - Display errors from laravel validation rules (UI Utilities / Form)
- awesome-vue - laravel-vue-validator - Display errors from laravel validation rules (UI Utilities / Form)
README
# Laravel Vue Validator
By [bubbleflat.com](https://bubbleflat.com)
This package allow to display errors from laravel validation rules
! This package needs vue-resource to work !
# Installation
```
npm install --save laravel-vue-validator
```
```javascript
import LaravelVueValidator from 'laravel-vue-validator'
Vue.use(LaravelVueValidator)
```
# Usage Example
If you have in your laravel validation rule :
`'name' => 'required|min:2|max:20'`
You can display the error using in vue :
``
This error will only be displayed if a 422 error is produced by laravel when the form is submited (when the rule is not satisfied)
To flush errors in a vue component:
`this.$errors.flush()`
# Full Example
```html
Submit
export default {
data(){
return{
name: ''
}
},
methods(){
// Error are displayed if Laravel backend return 422 Http code with name as error
this.$http.post('/submit', {name: this.name});
}
}
```