You would have to pass that session()->get('last_hand') as a prop.
Jan 28, 2019
2
Level 3
Variables From Laravel Session To Vue
I know there are other threads created about this, but I've been scouring them for over an hour and I cannot seem to understand how to achieve the desired functionality I want.
I have a text input bound to "hand", a data property in my Vue instance. This is set to blank by default. There is a button next to the input with an @click="lastHand", which calls a Vue method that is supposed change the hand property to the value of session->get('last_hand').
Here is my Vue code, which references the problem:
const app = new Vue({
el: '#app',
data: {
hand: ''
},
methods: {
lastHand() {
this.hand = "This string should be equal to session()->get('last_hand'), how do I put that here?"
}
}
});
Please or to participate in this conversation.