Livewire is not working without PHP artisan serve

Viewed 1989

When I use php artisan serve, Livewire is working fine.

Screenshot here

When I use XAMPP (http://localhost/daily/public/) to view Laravel, Livewire is not working, it keeps submitting the form when I submit. It should not submit because of Livewire. It is working fine in php artisan serve. Livewire is not working XAMPP.

(http://localhost/daily/public/) Screenshot here

2 Answers

First of all you should publish livewire configurational file with next command:

php artisan livewire:publish --config

Then in config folder you would be able to find file htdocs\YourProjectName\config\livewire.php where you would be able to edit the next string:

'asset_url'  => null,

to

'asset_url'  => 'http://localhost/YourProjectName/public',

And it should work after that. At least it worked in my case.

Docs: https://laravel-livewire.com/docs/2.x/installation

But in docs that string is called:

'asset_base_url' => '/assets'

instead of

'asset_url'  => 'http://localhost/YourProjectName/public',

But in the end it doesn't matter;)

Looks like you are on Windows. Consider switching to laragon. The thing just works

Related