28 lines
701 B
PHP
28 lines
701 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Providers;
|
||
|
|
|
||
|
|
use Illuminate\Pagination\Paginator;
|
||
|
|
use Illuminate\Support\ServiceProvider;
|
||
|
|
|
||
|
|
class ViewServiceProvider extends ServiceProvider
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Bootstrap any application services.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function boot(): void
|
||
|
|
{
|
||
|
|
// * FORCE BOOTSTRAP PAGINATOR (or custom if in front)
|
||
|
|
if (!app()->runningInConsole()) {
|
||
|
|
// Early boot, request wont be filled as expected.
|
||
|
|
Paginator::defaultView(
|
||
|
|
(collect(explode('/', \request()->getPathInfo()))->get(1) === 'bo')
|
||
|
|
? 'bo.modules.pagination'
|
||
|
|
: 'fo.modules.pagination'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|