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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 999
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to add admin prefix in CakePHP 3.0 version ?

    If we want to add admin prefix in our CakePHP web application then firstly we have to use CakePHP 3.0 version because we can not add admin prefix in CakePHP 2.* version.

    we can easily add admin prefix in our CakePHP web application just write the following lines in core.php.

    <?php Configure::write('Routing.prefixes', array('admin'));  ?>
    

    Also we have to write below code to enable cakephp 3.0 in app/config/routes.php

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

    Now we have will create Admin folder inside Controller src:

     src/Controller/Admin/UsersController.php

    And add following lines of code in UsersController.php

     namespace App\Controller\Wcbadmin;

    Now we will create the view file:

     src/Template/Admin/Users/login.ctp

    I hope this blog will help you.

    thanks

 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: