当前位置: 首页>>代码示例>>PHP>>正文


PHP Query::table方法代码示例

本文整理汇总了PHP中Query::table方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::table方法的具体用法?PHP Query::table怎么用?PHP Query::table使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Query的用法示例。


在下文中一共展示了Query::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: paginate

 public static function paginate($page = 1, $perpage = 10)
 {
     $query = Query::table(static::table());
     $count = $query->count();
     $results = $query->take($perpage)->skip(($page - 1) * $perpage)->sort('title')->get();
     return new Paginator($results, $count, $page, $perpage, Uri::to('admin/companies'));
 }
开发者ID:pepfi,项目名称:anchor-cms,代码行数:7,代码来源:company.php

示例2: __callStatic

 public static function __callStatic($method, $arguments)
 {
     $obj = Query::table(static::table())->apply(get_called_class());
     if (method_exists($obj, $method)) {
         return call_user_func_array(array($obj, $method), $arguments);
     }
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:7,代码来源:base.php

示例3: account

 private static function account($settings)
 {
     $account = $settings['account'];
     $database = $settings['database'];
     $query = Query::table($database['prefix'] . 'users', static::$connection);
     $query->insert(array('username' => $account['username'], 'password' => Hash::make($account['password']), 'email' => $account['email'], 'real_name' => 'Administrator', 'bio' => 'The bouse', 'status' => 'active', 'role' => 'administrator'));
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:7,代码来源:installer.php

示例4: paginate

 public static function paginate($page = 1, $perpage = 10)
 {
     $query = Query::table(static::table());
     $count = $query->count();
     $results = $query->take($perpage)->skip(($page - 1) * $perpage)->sort('date', 'desc')->get();
     return new Paginator($results, $count, $page, $perpage, url('comments'));
 }
开发者ID:gautamkrishnar,项目名称:Anchor-CMS-openshift-quickstart,代码行数:7,代码来源:comment.php

示例5: paginate

 public static function paginate($page = 1, $perpage = 10)
 {
     $query = Query::table(static::table());
     $count = $query->count();
     $results = $query->take($perpage)->skip(($page - 1) * $perpage)->sort('real_name', 'desc')->get();
     return new Paginator($results, $count, $page, $perpage, Uri::to('users'));
 }
开发者ID:gautamkrishnar,项目名称:Anchor-CMS-openshift-quickstart,代码行数:7,代码来源:user.php

示例6: up

 public function up()
 {
     $table = Base::table('meta');
     if ($this->has_table($table)) {
         if (!Query::table($table)->where('key', '=', 'comment_notifications')->count()) {
             Query::table($table)->insert(array('key' => 'comment_notifications', 'value' => 0));
         }
     }
 }
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:9,代码来源:10_add_comment_notifications.php

示例7: up

 public function up()
 {
     $table = Base::table('categories');
     if ($this->has_table($table)) {
         if (!Query::table($table)->count()) {
             Query::table($table)->insert(array('title' => 'Uncategorised', 'slug' => 'uncategorised', 'description' => 'Ain\'t no category here.'));
         }
     }
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:9,代码来源:71_insert_default_categories.php

示例8: search

 public static function search($term, $page = 1, $per_page = 10)
 {
     $query = Query::table(Base::table('posts'));
     $query->join(Base::table('wtfsearch'), Base::table('posts.id'), '=', Base::table('wtfsearch.post_id'));
     $query->left_join(Base::table('users'), Base::table('users.id'), '=', Base::table('posts.author'))->where(Base::table('posts.status'), '=', 'published')->where(Base::table('wtfsearch.meta_value'), 'like', '%' . $term . '%');
     $query->group(Base::table('posts.id'));
     $total = $query->count();
     $posts = $query->take($per_page)->skip(--$page * $per_page)->get(array(Base::table('posts.*'), Base::table('users.id as author_id'), Base::table('users.bio as author_bio'), Base::table('users.real_name as author_name')));
     return array($total, $posts);
 }
开发者ID:svita-cz,项目名称:web,代码行数:10,代码来源:wtfsearch.php

示例9: get_posts_with_tag

/**
 * Returns an array of ids for posts that have the specified tag
 *
 * @param string
 * @return array
 */
function get_posts_with_tag($tag)
{
    $tag_ext = Extend::where('key', '=', 'post_tags')->get();
    $tag_id = $tag_ext[0]->id;
    $prefix = Config::db('prefix', '');
    $posts = array();
    foreach (Query::table($prefix . 'post_meta')->where('extend', '=', $tag_id)->where('data', 'LIKE', '%' . $tag . '%')->get() as $meta) {
        $posts[] = $meta->post;
    }
    return array_unique($posts);
}
开发者ID:christhulhu,项目名称:anchor-dark,代码行数:17,代码来源:functions.php

示例10: up

 public function up()
 {
     $table = Base::table('meta');
     if ($this->has_table($table)) {
         if (!Query::table($table)->where('key', '=', 'dashboard_page')->count()) {
             Query::table($table)->insert(array('key' => 'dashboard_page', 'value' => 'panel'));
         } else {
             Query::table($table)->where('key', '=', 'dashboard_page')->update(array('value' => 'panel'));
         }
     }
 }
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:11,代码来源:212_insert_default_dashboard_meta_key.php

示例11: up

 public function up()
 {
     $table = Base::table('meta');
     if ($this->has_table($table)) {
         if (!Query::table($table)->where('key', '=', 'show_all_posts')->count()) {
             Query::table($table)->insert(array('key' => 'show_all_posts', 'value' => 0));
         } else {
             Query::table($table)->where('key', '=', 'show_all_posts')->update(array('value' => 0));
         }
     }
 }
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:11,代码来源:180_insert_meta_key.php

示例12: renew

 public static function renew()
 {
     $version = static::touch();
     $today = date('Y-m-d H:i:s');
     $table = Base::table('meta');
     Query::table($table)->where('key', '=', 'last_update_check')->update(array('value' => $today));
     Query::table($table)->where('key', '=', 'update_version')->update(array('value' => $version));
     // reload database metadata
     foreach (Query::table($table)->get() as $item) {
         $meta[$item->key] = $item->value;
     }
     Config::set('meta', $meta);
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:13,代码来源:update.php

示例13: migrations

 public static function migrations()
 {
     $current = Config::meta('current_migration');
     $migrate_to = Config::migrations('current');
     $migrations = new Migrations($current);
     $table = Base::table('meta');
     if (is_null($current)) {
         $number = $migrations->up($migrate_to);
         Query::table($table)->insert(array('key' => 'current_migration', 'value' => $number));
     } else {
         if ($current < $migrate_to) {
             $number = $migrations->up($migrate_to);
             Query::table($table)->where('key', '=', 'current_migration')->update(array('value' => $number));
         }
     }
 }
开发者ID:ericluwj,项目名称:lco,代码行数:16,代码来源:application.php

示例14: up

 public function up()
 {
     $table = Base::table('pagetypes');
     if (!$this->has_table($table)) {
         $sql = "CREATE TABLE IF NOT EXISTS `" . $table . "` (\n\t\t\t\t`key` varchar(32) NOT NULL,\n\t\t\t\t`value` varchar(32) NOT NULL\n\t\t\t) ENGINE=InnoDB";
         DB::ask($sql);
         Query::table($table)->insert(array('key' => 'all', 'value' => 'All Pages'));
     }
     $table2 = Base::table('extend');
     if (!$this->has_table_column($table2, 'pagetype')) {
         $sql2 = "ALTER TABLE `" . $table2 . "` ADD `pagetype` VARCHAR(140) NOT NULL DEFAULT 'all' AFTER `type`";
         DB::ask($sql2);
     }
     $table3 = Base::table('pages');
     if (!$this->has_table_column($table3, 'pagetype')) {
         $sql2 = "ALTER TABLE `" . $table3 . "` ADD `pagetype` VARCHAR(140) NOT NULL DEFAULT 'all' AFTER `slug`";
         DB::ask($sql2);
     }
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:19,代码来源:201_enable_pagetypes.php

示例15: company_count

function company_count()
{
    return Query::table(Base::table('posts'))->where('company', '=', company_id())->where('status', '=', 'published')->count();
}
开发者ID:pepfi,项目名称:anchor-cms,代码行数:4,代码来源:companies.php


注:本文中的Query::table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。