ldc-com-app-bo/app/Providers/ViewServiceProvider.php
2025-05-21 16:29:18 +02:00

31 lines
819 B
PHP

<?php
namespace App\Providers;
use App\Models\Tenant;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
class ViewServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(): void
{
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();
}
}
View::share('tenantModels', Tenant::get());
}
}