PHP code example of kavezoo / jeffadmin

1. Go to this page and download the library: Download kavezoo/jeffadmin 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/ */

    

kavezoo / jeffadmin example snippets




return [
    // …
    'JeffAdmin' => [],
];

public function bootstrap(): void
{
    parent::bootstrap();

    $this->addPlugin('JeffAdmin');
}

use Cake\Core\Configure;

Configure::write('Bake.theme', 'JeffAdmin');

Configure::write('Session', [
    'defaults' => 'php',
    'cookie' => 'NameOfCookie',
    'timeout' => 4320, // 3 days
]);


declare(strict_types=1);

namespace App\Controller\Admin;

use JeffAdmin\Controller\AppController as JeffAdminAppController;

class AppController extends JeffAdminAppController
{
    public function initialize(): void
    {
        parent::initialize();
    }
}

$routes->prefix('Admin', function (RouteBuilder $builder) {
    $builder->setRouteClass(DashedRoute::class);
    $builder->connect('/', ['controller' => 'Cities', 'action' => 'index']);
    $builder->fallbacks(DashedRoute::class);
});

$routes->prefix('Member', function (RouteBuilder $builder) {
    $builder->setRouteClass(DashedRoute::class);
    $builder->connect('/', ['controller' => 'Clubs', 'action' => 'index']);
    $builder->fallbacks(DashedRoute::class);
});

use Cake\Core\Configure;

$show = Configure::read('JeffAdmin');
$showLocal = [];

$showLocal['edit'] = [
//    'relatedTables' => false,
//    'deleteButton'  => false,
];

$show = array_merge($show['edit'] ?? [], $showLocal['edit']);
text
templates/Admin/element/nav.php          ← your menu (copy & edit)
plugins/.../templates/element/nav.php    ← plugin default