dsdf64562672 2014-03-20 13:59 采纳率: 0%
浏览 33
已采纳

Ion Auth表名称对现有CI应用程序的更改

I need to change the name of the user table in an existing CI application which uses ion auth.

In the ion_auth.php file it has these configs:

    | -------------------------------------------------------------------------
    | Tables.
    | -------------------------------------------------------------------------
    | Database table names.
    */
    $config['tables']['users']           = 'users';
    $config['tables']['groups']          = 'groups';
    $config['tables']['users_groups']    = 'users_groups';
    $config['tables']['login_attempts']  = 'login_attempts';

    /*
    | Users table column and Group table column you want to join WITH.
    |
    | Joins from users.id
    | Joins from groups.id
    */
    $config['join']['users']  = 'user_id';
    $config['join']['groups'] = 'group_id';

The new table name needs to be "customer" the PK will be "customer_id" not just "id"

Which of these ['users'] = 'users'; is the actual table name?

In order to join the new customer_id to the existing users_groups table what do I need to do?

Do I have to edit ion_auth_model.php in anyway to achieve what I need to achieve?

Or is what I am trying to do way more complex than I think it is?

Thanks

@kevindeleon. Thanks for response.

When I make that change I get 5 errors, all a variation of this,

    A PHP Error was encountered

    Severity: Notice

    Message: Undefined index: customer

    Filename: models/ion_auth_model.php

    Line Number: 1362

Do I simply change those items to "customer" is there any reason for not doing that?

Thanks

  • 写回答

1条回答 默认 最新

  • doushi9729 2014-03-20 15:51
    关注

    If you are only concerned with changing the 'users' table name:

    $config['tables']['users']  = 'customers';
    

    And then just change the table name in your DB.

    There is no configuration option to change the column name from 'id' to something else that I know of.

    All of the Ion Auth methods are still going to use the "user" terminology though...as in delete_user, remember_user etc.

    I personally would just leave it all as is unless there is some business need to change it to 'customers,' or if you already have a table called 'users' or something. The reason I say this is that having different table names and column names from Ion Auth just ends up in confusion when discussing with other developers or when reading back-and-forth in the model/config when working...but that is just my experience with it. It is open source after-all and the code is out there...you can change the whole thing if you like! :D

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ESP8266连接阿里云出现问题
  • ¥15 被蓝屏搞吐了,有偿求帮解答,Ai回复直接拉黑
  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并