JavaScript::put - Method not found

Posted 1 year ago by Hawkydoky


I'm trying to access data of my PHP from Javascript to format my page. IE : I'm storing some information in a database, I'm getting them from PHP, and I use these information to format my page differently according to the user logged. Informations in the DB are not used only for this purpose.

To format my page I'm using some JavaScript, so I need to access these data in my JavaScript.

I followed this tuto :

But I still can't access to my data, it's telling me that method put was not found in JavaScript.

Here is my bit of code:

file.blade.php :


    <div class="container">
        Code for my page here. 

    <script type="text/javascript">




    return [
    'bind_js_vars_to_this_view' => 'footer',
    'js_namespace' => 'window'



namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\View\View;
use JavaScript;

class BusLine extends Model

    public function index()

            'foo' => 'bar',
            'age' => 29

        return View::make('hello');

    protected $table='bus_line';

    protected $fillable = [
        'ID', 'card_uid', 'bus_direction'


My footer.blade.php is empty, I added 'Laracasts\Utilities\JavaScript\JavaScriptServiceProvider::class' and ' 'JavaScript' => Laracasts\Utilities\JavaScript\JavaScriptFacade::class,' to app.php

I tried a few things like doing the PHP in another file and nothing changed. Always the same message. Maybe I've missed an installation step.

I'm totally new to Laravel / PHP so maybe my code is not structured correctly.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.