2023-03-27 12:17:31 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
2025-05-20 16:20:23 +02:00
|
|
|
use App\Models\Tenant;
|
2023-03-27 12:17:31 +02:00
|
|
|
use Illuminate\Pagination\Paginator;
|
2025-05-26 11:33:47 +02:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
2025-05-20 16:20:23 +02:00
|
|
|
use Illuminate\Support\Facades\View;
|
2025-05-26 11:33:47 +02:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2023-03-27 12:17:31 +02:00
|
|
|
|
|
|
|
|
class ViewServiceProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Bootstrap any application services.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2025-05-20 10:16:12 +02:00
|
|
|
public function boot(): void
|
2023-03-27 12:17:31 +02:00
|
|
|
{
|
|
|
|
|
if (!app()->runningInConsole()) {
|
|
|
|
|
// * FORCE BOOTSTRAP PAGINATOR (or custom if in front)
|
|
|
|
|
// Early boot, request wont be filled as expected.
|
|
|
|
|
if (collect(explode('/', \request()->getPathInfo()))->get(1) === 'bo') {
|
|
|
|
|
Paginator::defaultview('bo.modules.pagination');
|
|
|
|
|
} else {
|
|
|
|
|
Paginator::useBootstrap();
|
|
|
|
|
}
|
2025-08-28 18:34:10 +02:00
|
|
|
if (Schema::hasTable('tenants')) {
|
|
|
|
|
View::share('tenantsGlobal', Tenant::getTenantsCached());
|
|
|
|
|
}
|
2025-05-26 11:33:47 +02:00
|
|
|
}
|
2023-03-27 12:17:31 +02:00
|
|
|
}
|
|
|
|
|
}
|