First Commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?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', []);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user