Laravel undefined variable exception with vue.js Laravel undefined variable exception with vue.js vue.js vue.js

Laravel undefined variable exception with vue.js


add @{{message}}

that will tell blade to ignore this.


It's not a good approach to combine the same notation for front-end and back-end. Of course, with the @, Blade can ignore.

A much cleaner idea is to extract the front-end from back-end, because Blade and Vue.js use the same notation:

  • Front-end with html, css en javascript (in your case Vue.js)
  • Back-end (in php, Laravel in your case) as REST-api with php that returns json

The big advantages:

  • It's more secure
  • It's more maintainable
  • It's cleaner