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


PHP Query::where方法代码示例

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


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

示例1: extractWhereDef

 private function extractWhereDef(Query $query, $args)
 {
     if (sizeof($args) === 1) {
         $query->where($args[0]);
     } else {
         $query->where($args[0], $args[1]);
     }
 }
开发者ID:avz,项目名称:php-b2,代码行数:8,代码来源:B2.php

示例2: scopeEligibleParents

 /**
  * Limit results to only records that are eligible to be parents of the provided model.
  * Ineligible parents include: The provided model itself, models with the provided model 
  * as it's own parent already, and a model that is already the current model's parent
  *
  * @param Query $query
  * @param Model $model The model to check for eligible parents against
  * @return Query
  */
 public function scopeEligibleParents($query, $model)
 {
     $query->where('id', '!=', $model->id)->where(function ($query) use($model) {
         $query->where('parent_id', '!=', $model->id)->orWhereNull('parent_id');
     });
     if ($model->parent_id) {
         $query->where('id', '!=', $model->parent_id);
     }
     return $query;
 }
开发者ID:daftspunk,项目名称:oc-test-plugin,代码行数:19,代码来源:Member.php

示例3: Query

 function cnt_by_opt($_tid, $_cid, $_where = '')
 {
     // $this->debug();
     $c = new Query();
     $c->from = "recruit r, recruit_opt ro";
     $c->where("ro.recruit_id = r.id");
     $c->where_eq("code_type", $_tid);
     $c->where_eq("code_id", $_cid);
     if ($_where) {
         $c->where($_where);
     }
     $res = $this->counts($c);
     return $res;
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:14,代码来源:Recruit_opt.php

示例4: article

 public function article($id)
 {
     $query = new Query();
     $query->where(["id = {$id}"]);
     $post = $query->findOne('Posts');
     $this->render('article.html.twig', array('post' => $post));
 }
开发者ID:medrupaloscil,项目名称:frameSup,代码行数:7,代码来源:TestController.php

示例5: filterQuery

 /**
  * Filters a query object
  *
  * @param Query		$query
  * @param Eloquent	$model
  *
  * @return void
  */
 public function filterQuery(&$query, $model)
 {
     //if the field is
     if ($this->value !== '') {
         $query->where($model->table() . '.' . $this->field, '=', $this->value);
     }
 }
开发者ID:ajb,项目名称:rfpez,代码行数:15,代码来源:Bool.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('holidays')->delete();
     $db = App::make('AccessDB');
     $query = new Query('HOLIDAYS', $db->get_dbh());
     $query->where('DURATION', '>', 0);
     $result = $query->get('HOLIDAYID,STARTTIME,DURATION');
     $result_array = [];
     foreach ($result as $row) {
         $start_time = strtotime($row['STARTTIME']);
         $duration = $row['DURATION'] - 1;
         $end_time = strtotime("+{$duration} days", $start_time);
         $result_array[] = ['id' => $row['HOLIDAYID'], 'start' => $row['STARTTIME'], 'duration' => $row['DURATION'], 'end' => date('Y-m-d H:i:s', $end_time)];
     }
     $holiday = array_chunk($result_array, 1000);
     foreach ($holiday as $value) {
         Holiday::insert($value);
     }
     $convert_file = public_path() . '\\Last Convert.txt';
     $record = explode(';', file_get_contents($convert_file));
     $record[2] = $result[count($result) - 1]['HOLIDAYID'];
     $file = fopen($convert_file, 'w');
     fwrite($file, implode(';', $record));
     fclose($file);
 }
开发者ID:radityapradipta,项目名称:Absensi-Binbak,代码行数:30,代码来源:HolidaySeeder.php

示例7: testShouldGenerateSelectWithWhere

 public function testShouldGenerateSelectWithWhere()
 {
     $query = new Query('users');
     $expected = "SELECT * FROM users WHERE username = 'Mario';";
     $query->where("username = 'Mario'");
     $result = $query->generate();
     $this->assertEquals($expected, $result);
 }
开发者ID:amaivsimau,项目名称:dojos,代码行数:8,代码来源:QueryTest.php

示例8: cnt

 function cnt($_where)
 {
     $c = new Query();
     if ($_where) {
         $c->where($_where);
     }
     return $this->counts();
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:8,代码来源:Space.php

示例9: Query

 function get_by_member($_user)
 {
     $c = new Query();
     $c->from = "startup_local sl, local l";
     $c->where("sl.local_id = l.id");
     $c->where_eq("startup_id", $_user);
     $res = $this->fetch("*", $c);
     return $res;
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:9,代码来源:Startup_local.php

示例10: cnt

 function cnt($_where = '')
 {
     // $this->debug();
     $c = new Query();
     if ($_where) {
         $c->where($_where);
     }
     return $this->counts($c);
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:9,代码来源:Event_reserve.php

示例11: Query

 function get_by_member_c($_user)
 {
     $c = new Query();
     $c->from = "member_local ml, code c";
     $c->where("ml.local_id = c.id");
     $c->where_eq("user_id", $_user);
     $res = $this->fetch("*", $c);
     return $res;
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:9,代码来源:Member_local.php

示例12: Query

 function list_($_user)
 {
     $c = new Query();
     $c->from = "member_project mp, startup s";
     $c->where("mp.startup_id = s.id");
     $c->where_eq("user_id", $_user);
     $c->order = "mp.id ASC";
     $res = $this->fetch("mp.*, s.name", $c);
     return $res;
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:10,代码来源:Member_project.php

示例13: Query

 function list_($_page, $_pagesize, $_where = '', $_order = '')
 {
     // $this->debug();
     $c = new Query();
     $c->from = "members m, member_grade mg, member_interist mi";
     $c->where("mg.id = m.grade");
     $c->where("mi.user_id = m.id");
     if ($_where) {
         $c->where($_where);
     }
     if ($_order) {
         $c->order = $_order;
     } else {
         $c->order = "m.id DESC";
     }
     $c->page = $_page;
     $c->page_size = $_pagesize;
     $res = $this->fetch("m.*, mg.name gname", $c);
     return $res;
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:20,代码来源:Member_interist.php

示例14: Query

 function get_by_form_res_user($_fid, $_aid)
 {
     // $this->debug();
     $c = new Query();
     $c->from = "competitions_form_res cfr, competitions_form cf";
     $c->where("cf.id = cfr.c_form_id");
     $c->where_eq("c_form_id", $_fid);
     $c->where_eq("apply_id", $_aid);
     $res = $this->fetch_one("*", $c);
     return $res;
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:11,代码来源:Competitions_form.php

示例15: getElectives

 static function getElectives($program, $elective_type, $elective_group, $exclude = [])
 {
     $results = array();
     foreach (explode("|", $elective_group) as $group) {
         $q = new Query("electives");
         $q->select("course_code");
         $q->where("program_id=?\n\t\t\t\t\t\t\tAND elective_type=?\n\t\t\t\t\t\t\tAND note=?\n\t\t\t\t\t\t\tAND course_code NOT IN " . Query::valuelistsql($exclude), array_merge([$program, $elective_type, $group], $exclude));
         $results = array_merge($results, $q->executeFetchAll());
     }
     return $results;
 }
开发者ID:mattmaynes2,项目名称:Coursinator,代码行数:11,代码来源:electives.php


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