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


PHP Eloquent::getTable方法代码示例

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


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

示例1: hasColumn

 /**
  * Check if model's table has column
  *
  * @param \Eloquent $model
  * @param string $column
  * @return bool
  */
 public static function hasColumn($model, $column)
 {
     $table = $model->getTable();
     $columns = \Cache::remember('amigridview.columns.' . $table, 60, function () use($table) {
         return \Schema::getColumnListing($table);
     });
     return array_search($column, $columns) !== false;
 }
开发者ID:assurrussa,项目名称:grid-view-vue,代码行数:15,代码来源:Model.php

示例2: _getSchema

 /**
  * Retrieve table schema
  * @return array
  */
 private function _getSchema()
 {
     if ($this->model && !is_null($this->model)) {
         $this->columns = \Schema::getColumnListing($this->model->getTable());
         foreach ($this->columns as $column) {
             $this->schema[$column] = new FormSchema(\DB::connection()->getDoctrineColumn($this->model->getTable(), $column));
         }
         return $this;
     }
 }
开发者ID:derduesseldorf,项目名称:formbuilder,代码行数:14,代码来源:Formbuilder.php

示例3: getValues

 /**
  * Gets the picked values for the entered fields
  *
  * @param  array    $fields
  * @param  Eloquent $model
  * @return array
  */
 protected function getValues($fields, $model, $page)
 {
     $values = array_except($model->toArray(), ['id', 'created_at', 'updated_at', 'deleted_at']);
     foreach ($fields as $field) {
         foreach ($field->picks as $modelAttribute => $fieldAttribute) {
             $values[$modelAttribute] = $field->values->get($fieldAttribute, null);
         }
     }
     if ($this->Schema->hasColumn($model->getTable(), 'page_version_id')) {
         $values['page_version_id'] = $page['page_version_id'];
     }
     if ($this->Schema->hasColumn($model->getTable(), 'language_id')) {
         $values['language_id'] = $page['language_id'];
     }
     return $values;
 }
开发者ID:devisephp,项目名称:cms,代码行数:23,代码来源:ModelManager.php

示例4: getTable

 /**
  * @return string
  */
 public function getTable()
 {
     return $this->model->getTable();
 }
开发者ID:marcmascarell,项目名称:laravel-artificer,代码行数:7,代码来源:ModelSchema.php

示例5: __construct

 public function __construct(array $attributes = [])
 {
     parent::__construct($attributes);
     $this->tableName = parent::getTable();
 }
开发者ID:paulvl,项目名称:magicmodel,代码行数:5,代码来源:MagicModel.php

示例6: save

 /**
  * @param $className
  * @param $parameters
  * @param null $objectId
  * @return ParseResponse
  * @throws \Exception
  */
 public function save($className, $parameters, $objectId = null)
 {
     $values = array();
     // if update, try to get the current object at first
     if ($objectId) {
         $this->object = $this->object->findOrFail($objectId);
     }
     foreach ($parameters as $key => $val) {
         if (in_array($key, $this->columns)) {
             if (is_array($val) && ($operation = array_get($val, '__op'))) {
                 switch ($operation) {
                     case "Increment":
                         $val = $this->object->{$key} ? $this->object->{$key} + $val['amount'] : $val['amount'];
                         break;
                     case "decrement":
                         $val = $this->object->{$key} - $val['amount'];
                         break;
                     case "Delete":
                         $val = null;
                         break;
                     case "Batch":
                         //                            $ops = $val['ops'];
                         //                            foreach ($ops as $ops_key => $ops_val) {
                         //                                if ($ops_val['__op'] == 'AddRelation') {
                         //                                    foreach ($ops_val['objects'] as $objects_key => $objects_val) {
                         //                                        $relation_type = $objects_val['__type'];
                         //                                        $relation_class_name = $objects_val['className'];
                         //                                        $relation_class_name = ParseHelperClass::removeUnderscoreFromClassName($relation_class_name);     // to remove '_' character if founded in the name of class _User
                         //                                        $relation_objectId = $objects_val['objectId'];
                         //                                        $relation_object = ParseHelperClass::createObject($relation_class_name);
                         //                                        $updatedAt = '';
                         //
                         //                                        if (!$relation_object) {
                         //                                            return ParseHelperClass::error_message_return('105');
                         //                                        }
                         //
                         //                                        $object->find($objectId)->$key()->sync([$relation_objectId], false);
                         //
                         //                                        $relation_data_of_object = $object::find(60)->$key()->where($relation_class_name . '_id',
                         //                                            '=', $relation_objectId)->get();
                         //
                         //                                        foreach ($relation_data_of_object as $relation_data) {
                         //                                            $updatedAt = $relation_data->pivot->createdAt;
                         //                                        }
                         //                                    }
                         //
                         //                                    return array(
                         //                                        "updatedAt" => Carbon::parse($updatedAt)->format('Y-m-d\TH:i:s.z\Z')
                         //                                    );
                         //                                }
                         //                            }
                         break;
                 }
             }
             $values[$key] = $val;
         } elseif (in_array($key, $this->relations)) {
             //
         } else {
             if ($key != "ACL") {
                 ParseHelper::throwException('210', $key);
             }
         }
     }
     $this->object->fill($values);
     try {
         $event = $this->object->getKey() ? 'update' : 'insert';
         \Event::fire("before.{$event}." . $this->object->getTable(), $this->object);
         $this->object->save();
         //create new object
         // now we can attach the relations
         foreach ($parameters as $key => $val) {
             if (in_array($key, $this->relations)) {
                 if ($operation = array_get($val, '__op')) {
                     switch ($operation) {
                         case "Delete":
                             $this->object->{$key}()->delete($val);
                             break;
                     }
                 } elseif ($this->object->{$key}() instanceof BelongsTo) {
                     $this->object->{$key}()->associate($val);
                 } elseif (!$this->object->{$key}() instanceof BelongsTo) {
                     $this->object->{$key}()->save($val);
                 } else {
                     ParseHelper::throwException(105);
                 }
             }
         }
         \Event::fire("after.{$event}." . $this->object->getTable(), $this->object);
     } catch (\Exception $ex) {
         ParseHelper::throwException(141, $ex->getMessage());
     }
 }
开发者ID:malimu,项目名称:baas,代码行数:99,代码来源:ParseBaseController.php


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