Example #1
0
 /**
  * run before initialize the class
  * use this method to set new table prefix with multisite.
  */
 public static function _init()
 {
     // get current site id
     $site_id = \Model_Sites::getSiteId(false);
     if ($site_id != '1') {
         static::$_table_name = $site_id . '_' . static::$_table_name;
     }
 }
 /**
  * init the class
  */
 public static function _init()
 {
     // auth config
     \Config::load('ormauth', true);
     // set the connection this model should use
     static::$_connection = \Config::get('ormauth.db_connection');
     // set the models table name
     static::$_table_name = \Config::get('ormauth.table_name', 'users') . '_user_permissions';
 }
Example #3
0
 /**
  * init the class
  */
 public static function _init()
 {
     // auth config
     \Config::load('ormauth', true);
     // set the connection this model should use
     static::$_connection = \Config::get('ormauth.db_connection');
     // set the write connection this model should use
     static::$_write_connection = \Config::get('ormauth.db_write_connection') ?: static::$_connection;
     // set the models table name
     static::$_table_name = \Config::get('ormauth.table_name', 'users') . '_providers';
 }
Example #4
0
 /**
  * init the class
  */
 public static function _init()
 {
     // auth config
     \Config::load('ormauth', true);
     // set the connection this model should use
     static::$_connection = \Config::get('ormauth.db_connection');
     // set the models table name
     static::$_table_name = \Config::get('ormauth.table_name', 'users') . '_groups';
     // set the relations through table names
     static::$_many_many['roles']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_group_roles';
     static::$_many_many['permissions']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_group_permissions';
     // model language file
     \Lang::load('auth_model_group', true);
 }
Example #5
0
 public static function _init()
 {
     Config::load('autho', 'autho');
     Config::load('hybrid', 'hybrid');
     $config = Config::get('autho.mysql_timestamp');
     static::$_table_name = Config::get('hybrid.tables.social', static::$_table_name);
     switch ($config) {
         case true:
         case false:
             static::$_created_at = 'created_at';
             static::$_updated_at = 'updated_at';
             static::$_mysql_timestamp = $config;
             break;
         case null:
         default:
             // don't do anything
     }
 }
Example #6
0
 /**
  * init the class
  */
 public static function _init()
 {
     // auth config
     \Config::load('ormauth', true);
     // set the connection this model should use
     static::$_connection = \Config::get('ormauth.db_connection');
     // set the write connection this model should use
     static::$_connection = \Config::get('ormauth.db_write_connection');
     // set the models table name
     static::$_table_name = \Config::get('ormauth.table_name', 'users') . '_roles';
     // set the relations through table names
     static::$_many_many['users']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_user_roles';
     static::$_many_many['groups']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_group_roles';
     static::$_many_many['permissions']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_role_permissions';
     // model language file
     \Lang::load('auth_model_role', true);
     // set the filter options from the language file
     static::$_properties['filter']['form']['options'] = \Lang::get('auth_model_role.permissions');
 }
Example #7
0
 /**
  * init the class
  */
 public static function _init()
 {
     // auth config
     \Config::load('auth', true);
     // get the auth driver in use
     $drivers = normalize_driver_types();
     // modify the model definition based on the driver used
     if (in_array('Simpleauth', $drivers)) {
         // remove properties not in use
         unset(static::$_properties['group_id']);
         unset(static::$_properties['previous_login']);
         unset(static::$_properties['user_id']);
         // remove relations
         static::$_eav = array();
         static::$_belongs_to = array();
         static::$_has_many = array();
         static::$_many_many = array();
         // remove observers
         unset(static::$_observers['Orm\\Observer_Self']);
         // simpleauth config
         \Config::load('simpleauth', true);
         // set the connection this model should use
         static::$_connection = \Config::get('simpleauth.db_connection');
         // set the write connection this model should use
         static::$_write_connection = \Config::get('simpleauth.db_write_connection') ?: static::$_connection;
         // set the models table name
         static::$_table_name = \Config::get('simpleauth.table_name', 'users');
     } elseif (in_array('Ormauth', $drivers)) {
         // remove properties not in use
         unset(static::$_properties['group']);
         unset(static::$_properties['profile_fields']);
         // ormauth config
         \Config::load('ormauth', true);
         // set the connection this model should use
         static::$_connection = \Config::get('ormauth.db_connection');
         // set the write connection this model should use
         static::$_write_connection = \Config::get('ormauth.db_write_connection') ?: static::$_connection;
         // set the models table name
         static::$_table_name = \Config::get('ormauth.table_name', 'users');
         // set the relations through table names
         static::$_many_many['roles']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_user_roles';
         static::$_many_many['permissions']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_user_permissions';
     }
     // model language file
     \Lang::load('auth_model_user', true);
 }