Пример #1
0
 public static function lasts($start = 0, $active = true)
 {
     $where = 'TRUE';
     if ($active !== null) {
         $where = "estacao_post.active = " . ($active ? '1' : '0');
     }
     $posts = PG::toMatrix("SELECT\n\t\t\t\testacao_post.*,\n\t\t\t\tusers.name gamer_name,\n\t\t\t\tusers.src gamer_image,\n\t\t\t\tusers.slug gamer_slug\n\t\t\tFROM estacao_post\n\t\t\tLEFT JOIN users\n\t\t\tON users.id = estacao_post.user_id\n\t\t\tWHERE {$where}\n\t\t\tORDER BY estacao_post.created_at DESC\n\t\t\tLIMIT 12\n\t\t\tOFFSET {$start}");
     return $posts;
 }
 public static function all($active = null)
 {
     $table = self::$static_table;
     $where = 'TRUE';
     if ($active !== null) {
         $where = "{$table}.active = " . ($active ? 'TRUE' : 'FALSE');
     }
     return PG::toMatrix("SELECT * FROM {$table} WHERE {$where} ORDER BY id ASC");
     // ORDER BY weight ASC
 }
 public static function lasts($start = 0, $active = true)
 {
     $table = self::$static_table;
     $where = 'TRUE';
     if ($active !== null) {
         $where = "{$table}.active = " . ($active ? '1' : '0');
     }
     $users = PG::toMatrix("SELECT\n\t\t\t\t{$table}.*\n\t\t\tFROM {$table}\n\t\t\tLEFT JOIN users\n\t\t\tON users.id = estacao_post.user_id\n\t\t\tWHERE {$where}\n\t\t\tORDER BY estacao_post.created_at DESC\n\t\t\tOFFSET {$start}");
     return $users;
 }