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
Roles and Permissions in Laravel 13
14 lessons
57 min
How to Build Laravel 13 API From Scratch
30 lessons
1 h 23 min
How to Structure Laravel 13 Projects
16 lessons
1 h 32 min read