Search code examples
phplaravellaravel-livewire

LiveWire Data Binding Problem. (Uncaught ReferenceError: Livewire is not defined)


I'm new to LiveWire. I think I did everything right. (According to the documentation.) Why am I not getting interaction? Thanks..

--- welcome.blade ---

<html>
<head>
    <title>Livewire</title>
    @livewireStyles
</head>
<body>
    @livewire('hello-world')

    @livewireScripts
</body>
</html>

--- Controller ---

class HelloWorld extends Component
{
    public $name = 'Ugur';
    
    public function render()
    {
        return view('livewire.hello-world');
    }
}

--- hello-world.blade ---

<div>
    <input wire:model="name" type="text">

    Hello {{ $name }}
</div>

When the input value changes, the value on the side does not change.


Solution

  • SOLVED!

    I changed;

    .env

    APP_URL=http:/localhost //TO--> APP_URL=localhost/[project_name]/public

    and

    config/livewire.php

    'asset_url' => null, //TO--> 'asset_url' => env('APP_URL'),

    Source