33 lines
928 B
PHP
33 lines
928 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Tenant;
|
|
use Illuminate\Pagination\Paginator;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
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();
|
|
}
|
|
}
|
|
if (Schema::hasTable('tenants')) {
|
|
View::share('tenantsGlobal', Tenant::getTenantsCached());
|
|
}
|
|
}
|
|
}
|