A
A
Anton89892018-03-11 16:05:41
Laravel
Anton8989, 2018-03-11 16:05:41

Why does laravel throw an error when using double brackets ({{}} )?

When working with vue.js in laravel, an error appears:

Use of undefined constant message - assumed 'message' (this will throw an Error in a future version of PHP) (View: /home/vagrant/Code/mysite/resources/views/welcome.blade.php)

The code:

<!doctype html>
<html lang="{{ app()->getLocale() }}">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="https://cdn.jsdelivr.net/npm/vue"></script>

        <title>Vue</title>

        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
         
      
    </head>
    <body>

       <div id="app">   
         {{ message }}
       </div>

<script>
   var app = new Vue({
    el: '#app',
    data: {
    message: 'Привет, Vue!'
        }
    })
</script>
  
         
    </body>

</html>

Laravel swears at double brackets {{}}.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Starkov, 2018-03-11
@Anton8989

{{ $message }}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question