- Notifications
You must be signed in to change notification settings - Fork24
📦 An easy way to share the data from your backend to the JavaScript.
License
NotificationsYou must be signed in to change notification settings
coderello/laravel-shared-data
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Laravel Shared Data provides an easy way to share the data from your backend to the JavaScript.
Install the package:
composer require coderello/laravel-shared-data
Include the
@shareddirective into your blade layout before all scripts.Share the data from within Laravel:
share(['user'=>$user,'title'=>$title]);
Access the data from the JavaScript directly:
const user = window.sharedData.user;const title = window.sharedData.title;
Or using the built-it global helper:
const user = shared('user');const title = shared('title');
Laravel Shared Data is open-sourced software licensed under theMIT license.
About
📦 An easy way to share the data from your backend to the JavaScript.
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.