Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Cakephp 3.0: How to add admin prefix ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 101
    Comment on it

    When I was new to cakephp 3.0 then I faced issue adding admin prefix. In Cakephp 2.* it was simple, just write the following lines in core.php:

    Configure::write('Routing.prefixes', array('admin'));

    To enable cakephp 3.0 just write the following code in app/config/routes.php

    Router::prefix('admin', function($routes) {
    $routes->connect('/', ['controller'=>'Users','action'=>'login']);
    $routes->fallbacks('InflectedRoute');
    });

    Now make Admin folder inside Controller src: src/Controller/Admin/UsersController.php

    Add following lines of code in UsersController.php

    namespace App\Controller\Wcbadmin;

    Now make the view file: src/Template/Admin/Users/login.ctp

    Its all done!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: