Updates Livewire Script Route

This commit is contained in:
Refringe 2024-06-19 14:41:06 -04:00
parent bf29b348a5
commit 2bbe715342
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k
5 changed files with 10 additions and 6 deletions

View File

@ -4,7 +4,9 @@ namespace App\Providers;
use App\Models\User; use App\Models\User;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
@ -21,6 +23,11 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot(): void public function boot(): void
{ {
// Register the Livewire script route.
Livewire::setScriptRoute(function ($handle) {
return Route::get('/vendor/livewire/livewire.js', $handle);
});
// This gate determines who can access the Pulse dashboard. // This gate determines who can access the Pulse dashboard.
Gate::define('viewPulse', function (User $user) { Gate::define('viewPulse', function (User $user) {
return $user->isAdmin(); return $user->isAdmin();

View File

@ -114,7 +114,7 @@ return [
| |
*/ */
'inject_assets' => false, 'inject_assets' => true,
/* /*
|--------------------------------------------------------------------------- |---------------------------------------------------------------------------

View File

@ -1,7 +1,4 @@
import { Livewire } from "../../vendor/livewire/livewire/dist/livewire.esm";
import axios from "axios"; import axios from "axios";
Livewire.start();
window.axios = axios; window.axios = axios;
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";

View File

@ -56,6 +56,6 @@
@livewire('global-search') @livewire('global-search')
@stack('modals') @stack('modals')
@livewireScriptConfig @livewireScripts
</body> </body>
</html> </html>

View File

@ -35,6 +35,6 @@
{{ $slot }} {{ $slot }}
</div> </div>
@livewireScriptConfig @livewireScripts
</body> </body>
</html> </html>