In Laravel 5, how do you dump variables on vue enabled templates?

Viewed 6831

Prior to vue being part of Laravel, I would often debug by simply using {{ dump($var) }}

Doing so now throws an exception within javascript as Vue doesn't like <script> tags within the body of the content. It's not game breaking, but it is annoying. It still shows the whole array, just that the JavaScript around it doesn't work anymore.

Is there a Vue equivalent of laravel's dump? Can I tell Vue to ignore script tags when doing debugging?

To be clear, I'm looking to output the variable from PHP where it shows the properties, attributes, the type of value etc. I'm not looking to output an object within JavaScript.

3 Answers

You just need to have the dump() outside the div your vue app is mounted to. So for example in your layout.blade

<body>
    @yield('dump')
    <div id="app">

Then in your index.blade

@extends('layout')

@section('dump')
@dump($variable)
@endsection
Related