Example #1
0
 public static function getByUserId($userId)
 {
     $ret = array();
     $res = DB::schema('services')->getByUserId($userId);
     while ($row = $res->fetch()) {
         $service = new self();
         $service->id = $row->id;
         $service->key = $row->key;
         $service->auth = $row->auth;
         $ret[] = $service;
     }
     return $ret ? $ret : false;
 }
Example #2
0
File: App.php Project: Stoiss777/s
 public static function getById($id)
 {
     if ($row = DB::schema('apps')->getById($id)->first()) {
         $app = new self();
         $app->id = $id;
         $app->name = $row->name;
         $app->secret = $row->secret;
         $app->enabled = $row->getAsBoolean('enabled');
         $app->trusted = $row->getAsBoolean('trusted');
         $app->domains = $row->getAsArray('domains');
         $app->ip = $row->getAsArray('ip');
         $app->scopes = $row->getAsArray('scopes');
         return $app;
     }
     return false;
 }
Example #3
0
File: User.php Project: Stoiss777/s
 public function create()
 {
     $properties = $this->getProperties();
     if (empty($properties)) {
         $this->id = DB::schema('users')->create()->value();
     } else {
         $this->id = DB::schema('users')->create(json_encode($properties))->value();
     }
     foreach ($this->_services as $key => $service) {
         DB::schema('users')->bindService($this->id, $service->id, $key);
     }
     return true;
 }
Example #4
0
 /**
  * Загружает элементы из БД в self::$_data
  * 
  * @param string $mask - ключ или маска для выбора элементов
  */
 public function _fromBase($key)
 {
     $res = DB::schema('settings')->get($key);
     while ($row = $res->fetch()) {
         $this->set($row->key, $row);
     }
 }