Description
A Blade directive to export variables to JavaScript
This package contains a Blade directive to export values to JavaScript.
Here's an example of how it can be used:
@javascript('key', 'value')
The rendered view will output:
<script>window['key'] = 'value';</script>
So in your browser you now have access to a key variable:
console.log(key); //outputs "value"
Recent Courses on Laravel Daily
Laravel Boost: Deeper Practical Dive
8 lessons
32 min
NativePHP Mobile v4 with SuperNative: Mini-Course
5 lessons
18 min
Laravel 13 Starter Kit Teams and Customizations
10 lessons
33 min