Example #1
0
 public function all($model)
 {
     if (!is_object($model)) {
         throw new Exception('the first argument must be a model.');
     }
     $collection = [];
     $options = Model::Opt()->where(['object_id', '=', (int) $model->id])->where(['object_database', '=', (string) $model->_db->db])->where(['object_table', '=', (string) $model->_db->table])->exec();
     foreach ($options as $option) {
         $collection[$option['key']] = $option['value'];
     }
     return $collection;
 }