I have to do the view to update user profile in Vuejs, the view is currently done in blade and it works fine, but I have to pass everything to Vuejs.
From the sidebar.blade.php I pass the user to the Vue component named Profile.vue
<profile-component :auth="{{ Auth::user() }}"></profile-component>
The data I collect in the template of the Profile.vue component and they are shown in the text boxes of the form with v-model.
<template>
<div class="row">
<form class="form-horizontal form-material">
<div class="form-group">
<label class="col-md-12">Nombre</label>
<div class="col-md-12">
<input type="text" class="form-control form-control-line"
v-model="auth.name">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Apellido</label>
<div class="col-md-12">
<input type="text" class="form-control form-control-line"
v-model="auth.lastname">
</div>
</div>
<div class="form-group">
<label class="col-sm-12">Genero</label>
<div class="col-sm-12">
<select class="form-control form-control-line">
<option>Femenino</option>
<option>Masculino</option>
<option>Otra orientación</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-12">Sobre mi</label>
<div class="col-md-12">
<textarea rows="5" class="form-control form-control-line"
v-model="auth.description">
</textarea>
</div>
</div>
<div class="col-sm-12">
<button class="btn btn-success"
v-on:click="editUser()">Actualizar
</button>
</div>
</form>
</div>
</template>
<script>
export default {
props: ['auth'],
data() {
return {
user: {
firstName: '',
lastName: '',
gender: '',
descriptionUser: ''
},
}
},
methods: {
editUser(){
}
},
filters: {
moment: function(date) {
return moment(date).format("D [de] MMMM [de] YYYY ");
}
}
}
These are the arvhico routes we.php
Route::get('/panel/profile', 'UserController@userEdit');
Route::put('/panel/profile', 'UserController@userUpdate');
How can I do it with the Vuejs view?
I need to create the editUser () method
I confuse the subject because I have little with Vue, I'm using Laravel 5.6, Vuejs 2 and Axios.
Thank you very much