I'm using Laravel 8 and I wanted to install Sweet Alert. So after downloading it and adding require('sweetalert'); to bootstrap.js, I ran the command npm run production.
Then I have included this in my master.blade.php:
<script src="{{ asset('/js/app.js') }}"></script>
@include('sweet::alert')
Now because I had changed my public directory from public to public_html, Laravel asset() function would call the public_html/js/app.js and this is wrong because Laravel Mix generated app.js and app.css in the public directory.
So the question is how can I change the default generation of Laravel Mix which is public to public_html ?
Here is my AppServiceProvider.php:
public function register()
{
$this->app->bind('path.public', function(){
return base_path() . '/public_html';
});
}