@php($var = "whatever")
or
@php
$var = "whatever"
@endphp
When getting data in json
$users = User::all()->json();
In blade template using the data
var users = {{ $users }}
It will return error because the encoding will get code likeĀ "
Escaping the data with {{ }} automatically in Laravel 5. Use {!! $users !!} instead.