I'm new to Laravel 5 and I was trying to set up PHP-Vars-To-Js-Transformer .The problem is, that I'm unable to use JavaScript facade in my controller. This class is not found.
My Controller:
<?php namespace App\Http\Controllers;
class HomeController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
.....
return view('home',compact('decodedJSON','encodedMainArray'));
}
}
My // app/config/app.php
'providers' => [
'...',
'Laracasts\Utilities\JavaScript\JavascriptServiceProvider'
];
I've also run commands php artisan vendor:publish
and composer install
.
I don't know, if I'm missing something special..
Thanks
I've figured it out. The problem was in namespacing. The solution was to add use Laracasts\Utilities\JavaScript\JavaScriptFacade as JavaScript;
at the beginning of the controller file.