35 lines
902 B
PHP
Executable File
35 lines
902 B
PHP
Executable File
<?php
|
|
|
|
namespace Modules\PageBuilder\Providers;
|
|
|
|
use Kernel\Application;
|
|
use Kernel\View;
|
|
use Modules\PageBuilder\Models\Page;
|
|
|
|
class PageBuilderServiceProvider
|
|
{
|
|
public function register()
|
|
{
|
|
}
|
|
|
|
public function boot()
|
|
{
|
|
$app = Application::getInstance();
|
|
$app->addPublicPath('/pages*');
|
|
|
|
try {
|
|
$view = new View();
|
|
if (class_exists(Page::class)) {
|
|
// Assuming published scope exists as per original code
|
|
$pages_public = Page::published()->where('pages_public', true)->get();
|
|
$view->getEngine()->addGlobal('pages_public', $pages_public);
|
|
} else {
|
|
$view->getEngine()->addGlobal('pages_public', []);
|
|
}
|
|
} catch (\Exception $e) {
|
|
$view = new View();
|
|
$view->getEngine()->addGlobal('pages_public', []);
|
|
}
|
|
}
|
|
}
|