Tutorial for making admin section inside croogo 3.5

46 views
Skip to first unread message

Robert V.

unread,
Dec 17, 2019, 8:57:11 AM12/17/19
to Croogo
I was try to make admin plugin in root/plugins folder, with composer do not work.

Can someone make tutorial how to make this working on version 3.5.


TNX

Rachman Chavik

unread,
Dec 20, 2019, 12:10:40 AM12/20/19
to Croogo


On Tuesday, December 17, 2019 at 8:57:11 PM UTC+7, Robert V. wrote:
I was try to make admin plugin in root/plugins folder, with composer do not work.

Can someone make tutorial how to make this working on version 3.5.


This view was done on 2.x version: https://www.youtube.com/watch?v=gkpzKIuDuCM but the concept still applies.

Instead of `Console/cake`, you'd use `bin/cake`

When baking templates, use the Croogo/Core template theme.

It'd be something along these lines:

bin/cake bake plugin Foo
bin/cake bake model --plugin Foo Users
bin/cake bake controller --plugin Foo --prefix Admin Users
bin/cake bake template --plugin Foo --theme Croogo/Core Admin Users


 
TNX

Robert V.

unread,
Dec 20, 2019, 1:34:28 AM12/20/19
to Croogo
Thank you Rachman,

it was problem in plugin routes.php.
I was not working with new versions before like version 3.5, here is some sample tutorial for others who have same problem.

1.
bin/cake bake model Satellites --plugin Somepluginname --table satellites --no-fixture --no-test --force
bin/cake bake controller Satellites --plugin Somepluginname --prefix Admin --theme Croogo/Core --no-test --force
bin/cake bake template Satellites --plugin Somepluginname --prefix Admin --theme Croogo/Core --force

2. Plugin/config/routes.php

use Cake\Routing\RouteBuilder;
use Croogo\Core\Router;

Router::plugin('Somepluginname', ['path' => '/'], function (RouteBuilder $routeBuilder) {
    $routeBuilder->prefix('admin', function (RouteBuilder $routeBuilder) {
        $routeBuilder->extensions(['json']);

        $routeBuilder->connect('/admin/channels', [
            'plugin' => 'Somepluginname',
            'controller' => 'Channels',
            'action' => 'index',
        ]);

        $routeBuilder->fallbacks();
    });

    Router::build($routeBuilder, '/channels', [
        'plugin' => 'Somepluginname',
        'controller' => 'Channels',
        'action' => 'index',
    ]);
   
        $routeBuilder->connect('/locale', ['controller' => ' Users', 'action' => 'languageChange']);

        $routeBuilder->connect('/', ['controller' => 'Games', 'action' => 'main']);
        $routeBuilder->connect('/main', ['controller' => 'Games', 'action' => 'main']);


    $routeBuilder->fallbacks();
});


3. if not working then try to comment out this part. //'Crud.Search', in vendor/croogo/croogo/Core/src/Controller/AppController.

Robert V.

unread,
Dec 20, 2019, 1:59:31 AM12/20/19
to Croogo
This is error log when i uncomment Crud.Search from Core Admin AppController.

[RuntimeException] Missing Search.Search behavior on Somepluginname\Model\Table\LeaguesTable Request URL: /admin/leagues Referer URL: http://sport.local/admin/device-has-plugins/edit/1 Stack Trace: #0 /var/www/sport/vendor/cakephp/cakephp/src/Event/EventManager.php(416): Crud\Listener\SearchListener->injectSearch(Object(Cake\Event\Event))
Reply all
Reply to author
Forward
0 new messages