title: How to send value from controller of Laravel to Vue.js?
body: <p>I have controller "SomethingController", model "ValueModel" and View "Show.blade.php" and vue with component "vue-component"<br>
  Now i want to get send value (i got from model "ValueModel" and the value is in JSON format) from <strong>SomethingController</strong> to <strong>Show.balde.php</strong> which will consist vue <strong>"vue-component"</strong>. Finally, I want to get value in vue from the controller.</p>
  
  <p>I know how to send a value from controller to view. And I have sent it to vue when the value is in the string by using <strong>props</strong>. But I am not being able to send JSON value from prop to vue. </p>
  
  <p><strong>Controller</strong></p>
  
  <pre class="lang-php prettyprint-override"><code>//SomethingController.php
  class SomethingControllerextends Controller
  {
      public function index()
      {
          $e = ValueModel::get();
          $e = json_encode($e-&gt;toArray());
          return view('pages.Show')-&gt;with('e', $e);
      }
  }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre class="lang-php prettyprint-override"><code>//Show.blade.php
  &lt;div class="app"&gt;
      &lt;vue-component data={!!$e!!}&gt;&lt;/vue-component&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Vue</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>//SomethingController.php
  &lt;script&gt;
  export default {
      props: ['data'],
      data(){
          return{
              d : this.data,
          }
      },
      beforeCreate(){
          console.log('helllo');
          console.log(d)
          },
  }
  &lt;/script&gt;
  
  </code></pre>
  
  <p>To my surprise i am getting data being printed on window. and operations in function beforeCreate() is not working after the value is being printed on window.<br>
  <a href="https://i.stack.imgur.com/ScoLS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ScoLS.png" alt="![image of wrong output"></a>
  As shown in image, data is being printed on windows that is send from controller where as i want the data in vue.  I also want to know why it is being printed.</p>
  
  <blockquote>
    <p><strong>All works fine for String being returned from controller</strong></p>
  </blockquote>