Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Cakephp - Using Config.php

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 795
    Comment on it

    We can use config.php in cakephp to define constant which need to be used in our whole project example we have different role id for different users.We can define those user corresponding to their role id and can easily access them through out the project.

    We need to do following steps:

    1) Create config.php in config folder.
    2) In bootstrap.php add following line Configure::load('config');
    3) Write following code in config.php :

    ?php
    class ConstUserTypes {
        const Client = 1;
        const Barber = 2;
        const BarberShop = 3;
        const Healthician = 4;
        const Restaurant = 5;
        const Admin = 6;
    }
    
    4) Use can them by writing "ConstUserTypes::Restaurant"

 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: