Benzigar J S
Benzigar J S

Reputation: 51

Livewire is not working without PHP artisan serve

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

Upvotes: 5

Views: 5091

Answers (3)

Klaaz
Klaaz

Reputation: 1640

I can confirm that is is not working (Out of the box) in Laragon too.

While using it with 'php artisan serve' the url http://livewire.test/counter was correctly loaded from /public while within Laragon it was not. I suspected it having to do something with Xampp and Laragon using virtual domains.

After changing APP_URL to http://livewire.test/public it did not work either, but after a reload of Apache within Laragon it finnaly did.

Upvotes: 0

IVN
IVN

Reputation: 241

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;)

Upvotes: 3

Jovan
Jovan

Reputation: 1

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

Upvotes: -1

Related Questions