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


PHP Eloquent::table方法代码示例

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


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

示例1: setModelObject

 /**
  * 设置 Model 类型对象
  *
  * @param Model $model
  */
 public function setModelObject(Model $model)
 {
     $config = $model->getConnection();
     self::$table = $config['tablename'];
     $this->setConfig($config);
     self::$model = $model;
 }
开发者ID:qxy735,项目名称:YuYi-General,代码行数:12,代码来源:Eloquent.php

示例2: 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

示例3: constrainQuery

 /**
  * Constrains a query by a given set of constraints
  *
  * @param  Query 		$query
  * @param  Eloquent 	$model
  * @param  array 		$constraints
  *
  * @return void
  */
 public function constrainQuery(&$query, $model, $constraints)
 {
     //if the column hasn't been joined yet, join it
     if (!Column::isJoined($query, $this->table)) {
         $query->join($this->table, $model->table() . '.' . $model::$key, '=', $this->column2);
     }
     $query->where($this->column, '=', $constraints);
 }
开发者ID:SerdarSanri,项目名称:admin,代码行数:17,代码来源:HasManyAndBelongsTo.php

示例4: filterQuery

 /**
  * Adds selects to a query
  *
  * @param Query 	$query
  * @param array 	$selects
  * @param Eloquent 	$model
  *
  * @return void
  */
 public function filterQuery(&$query, &$selects, $model)
 {
     //add the select statement
     if ($this->select) {
         //if this is a related field, we have to set up a fancy select because of issues with grouping
         if ($this->isRelated) {
             $where = '';
             $fieldTable = $this->relationshipField->table;
             switch ($this->relationshipField->type) {
                 case 'belongs_to':
                     $fieldTable = $this->field . '_' . $this->relationshipField->table;
                     $where = $model->table() . '.' . $this->relationshipField->foreignKey . ' = ' . $fieldTable . '.' . $this->relationshipField->column;
                     break;
                 case 'has_one':
                 case 'has_many':
                     $where = $model->table() . '.' . $model::$key . ' = ' . $fieldTable . '.' . $this->relationshipField->column;
                     break;
                 case 'has_many_and_belongs_to':
                     $where = $model->table() . '.' . $model::$key . ' = ' . $this->relationshipField->column;
                     break;
             }
             $selects[] = DB::raw("(SELECT " . $this->select . "\n\t\t\t\t\t\t\t\t\t\tFROM " . $this->relationshipField->table . " AS " . $fieldTable . "\n\t\t\t\t\t\t\t\t\t\tWHERE " . $where . ") AS " . $this->field);
         } else {
             $selects[] = DB::raw($this->select . ' AS ' . $this->field);
         }
     }
 }
开发者ID:TahsinGokalp,项目名称:L3-Sozluk,代码行数:36,代码来源:Column.php

示例5: table

 /**
  * Get the table name
  * 
  * @return string
  */
 public function table()
 {
     $table = parent::table();
     $table = $this->prefix ? $this->prefix . $table : $table;
     return $table;
 }
开发者ID:marmaray,项目名称:OLD-laravel-France-website,代码行数:11,代码来源:eloquentverifybase.php


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