1. Go to this page and download the library: Download sirgrimorum/pages library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
'special_sections' => [
'featured_posts' => [
'type' => 'collection', // 'simple', 'collection', or 'model'
'isModel' => App\Models\Post::class,
'function' => 'getFeatured', // Method to call on the model
'template' => 'partials.featured_post', // Blade template for each item
],
'site_notice' => [
'type' => 'simple',
'template' => 'partials.site_notice', // Just renders a Blade view
],
],
use Sirgrimorum\Pages\Pages;
// Inject all accessible pages into position 2 of the left nav
$menuConfig = Pages::getAutoMenuConfig(2, 'izquierdo', config('sirgrimorum/menus/main'));
echo AutoMenu::buildAutoMenu('main-nav', '', $menuConfig);
use Sirgrimorum\Pages\Pages;
if (Pages::hasAccessToPagina($page)) {
// user can see this page
}
if (Pages::hasAccessToSection($section)) {
// user can see this section
}
Pages::buildPage(
mixed $name = '', // Page name, ID, object, or '' for first allowed
mixed $config = '', // Config array or path
mixed $sections = '' // Sections array override
): string
Pages::getAutoMenuConfig(
int $offset, // Position to insert pages in the menu array
string $lado, // Menu side: 'izquierdo' or 'derecha'
array $automenu // Existing menu structure to inject into
): array