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
Next.js Basics for Laravel Developers
11 lessons
58 min
Queues in Laravel 13
18 lessons
1 h 12 min read
How to Structure Laravel 13 Projects
16 lessons
1 h 32 min read