當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。