PHP code example of swisnl / laravel-javascript-data-response
1. Go to this page and download the library: Download swisnl/laravel-javascript-data-response library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
swisnl / laravel-javascript-data-response example snippets
Response::javascriptData('translations', ['en' => ['foo' => 'bar']]);
// or
response()->javascriptData('translations', ['en' => ['foo' => 'bar']]);
javascript
(function(){
window["translations"] = {
"en": {
"foo": "bar"
}
};
})();
bash
php artisan vendor:publish --provider="Swis\Laravel\JavaScriptData\ServiceProvider" --tag="config"