mirror of
https://github.com/snipe/snipe-it.git
synced 2026-04-07 08:18:30 +00:00
39 lines
940 B
PHP
39 lines
940 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Livewire\Livewire;
|
|
|
|
class LivewireServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
$prefix = trim((string) config('livewire.url_prefix', ''), '/');
|
|
if ($prefix === '') {
|
|
$prefix = trim((string) parse_url(config('app.url'), PHP_URL_PATH), '/');
|
|
}
|
|
$prefix = $prefix === '' ? '' : '/'.$prefix;
|
|
|
|
Livewire::setUpdateRoute(function ($handle) use ($prefix) {
|
|
return Route::post($prefix.'/livewire/update', $handle);
|
|
});
|
|
|
|
Livewire::setScriptRoute(function ($handle) use ($prefix) {
|
|
return Route::get($prefix.'/livewire/livewire.js', $handle);
|
|
});
|
|
}
|
|
}
|