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


PHP Model::getDates方法代码示例

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


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

示例1: __call

 /**
  * Format the value of a model attribute.
  *
  * Looks for $this->formatColumnName() methods.
  *
  * Note that the model's date/time attributes are automatically passed
  * through $this->__carbon().
  *
  * @param string $name
  * @param array $args
  * @return mixed
  */
 public function __call($name, array $args = [])
 {
     $method = 'format' . studly_case($name);
     if (method_exists($this, $method)) {
         return $this->{$method}();
     }
     $name = snake_case($name);
     if (in_array($name, $this->model->getDates())) {
         return $this->__carbon($name, data_get($args, 0), data_get($args, 1));
     }
     return data_get($this->model, $name);
 }
开发者ID:artissant,项目名称:stock,代码行数:24,代码来源:ViewModel.php

示例2: pluck

 /**
  * Get an array with the values of a given column.
  *
  * @param  string  $column
  * @param  string|null  $key
  * @return \Illuminate\Support\Collection
  */
 public function pluck($column, $key = null)
 {
     $results = $this->toBase()->pluck($column, $key);
     // If the model has a mutator for the requested column, we will spin through
     // the results and mutate the values so that the mutated version of these
     // columns are returned as you would expect from these Eloquent models.
     if (!$this->model->hasGetMutator($column) && !$this->model->hasCast($column) && !in_array($column, $this->model->getDates())) {
         return $results;
     }
     return $results->map(function ($value) use($column) {
         return $this->model->newFromBuilder([$column => $value])->{$column};
     });
 }
开发者ID:sopnopriyo,项目名称:sopnopriyo,代码行数:20,代码来源:Builder.php

示例3: getVisibleIndexDates

 /**
  * Get the visible model date attributes for the index.
  *
  * @param  \Illuminate\Database\Eloquent\Model $model
  * @return array
  */
 protected function getVisibleIndexDates(BaseModel $model)
 {
     if (count($model->getVisible()) > 0) {
         return array_intersect($model->getDates(), $model->getVisible());
     }
     return array_diff($model->getDates(), $model->getHidden());
 }
开发者ID:elodex,项目名称:elodex,代码行数:13,代码来源:IndexMapping.php

示例4: getDates

 /**
  * Get the attributes that should be converted to dates.
  *
  * @return array
  */
 public function getDates()
 {
     $this->getFields()->each(function ($field) {
         if ($field instanceof FieldTypeDateInterface) {
             $this->dates[] = $field->getDBKey();
         }
     });
     if ($this->hasField(static::CREATED_AT) and $this->hasField(static::UPDATED_AT)) {
         $this->timestamps = true;
     }
     return parent::getDates();
 }
开发者ID:KodiComponents,项目名称:module-datasource,代码行数:17,代码来源:Document.php

示例5: getDates

 /**
  * Get the attributes that should be converted to dates.
  *
  * @return array
  */
 public function getDates()
 {
     return array_merge(parent::getDates(), ['birthday']);
 }
开发者ID:rafaelvieiras,项目名称:connect,代码行数:9,代码来源:Client.php

示例6: getDates

 /**
  * Get the attributes that should be converted to dates.
  *
  * @return array
  */
 public function getDates()
 {
     return array_merge(parent::getDates(), ['started_at', 'completed_at']);
 }
开发者ID:rafaelvieiras,项目名称:connect,代码行数:9,代码来源:Project.php

示例7: getPropertiesFromTable

 /**
  * Load the properties from the database table.
  *
  * @param \Illuminate\Database\Eloquent\Model $model
  */
 protected function getPropertiesFromTable($model)
 {
     $table = $model->getConnection()->getTablePrefix() . $model->getTable();
     $schema = $model->getConnection()->getDoctrineSchemaManager($table);
     $databasePlatform = $schema->getDatabasePlatform();
     $databasePlatform->registerDoctrineTypeMapping('enum', 'string');
     $platformName = $databasePlatform->getName();
     $customTypes = $this->laravel['config']->get("ide-helper.custom_db_types.{$platformName}", array());
     foreach ($customTypes as $yourTypeName => $doctrineTypeName) {
         $databasePlatform->registerDoctrineTypeMapping($yourTypeName, $doctrineTypeName);
     }
     $database = null;
     if (strpos($table, '.')) {
         list($database, $table) = explode('.', $table);
     }
     $columns = $schema->listTableColumns($table, $database);
     if ($columns) {
         foreach ($columns as $column) {
             $name = $column->getName();
             if (in_array($name, $model->getDates())) {
                 $type = 'datetime';
             } else {
                 $type = $column->getType()->getName();
             }
             if (!($model->incrementing && $model->getKeyName() === $name) && $name !== $model::CREATED_AT && $name !== $model::UPDATED_AT) {
                 if (!method_exists($model, 'getDeletedAtColumn') || method_exists($model, 'getDeletedAtColumn') && $name !== $model->getDeletedAtColumn()) {
                     $this->setProperty($name, $type);
                 }
             }
         }
     }
 }
开发者ID:mpociot,项目名称:laravel-test-factory-helper,代码行数:37,代码来源:GenerateCommand.php

示例8: getDates

 /**
  * Get the attributes that should be converted to dates.
  *
  * @return array
  */
 public function getDates()
 {
     return array_merge(parent::getDates(), array('oauth2_expires'));
 }
开发者ID:Kiwing-IT-Solutions,项目名称:kiwing-social,代码行数:9,代码来源:Link.php

示例9: getDates

 public function getDates()
 {
     return array_merge(parent::getDates(), ['start_date', 'next_date']);
 }
开发者ID:n0th1n9,项目名称:daizhang,代码行数:4,代码来源:CompanyCycleBill.php

示例10: getDates

 /**
  * Get the attributes that should be converted to dates.
  *
  * @return array
  */
 public function getDates()
 {
     return array_merge(parent::getDates(), [static::PUBLISHED_AT]);
 }
开发者ID:dinghua,项目名称:crm,代码行数:9,代码来源:Content.php

示例11: getDates

 public function getDates()
 {
     return array_merge(parent::getDates(), ['expire_at']);
 }
开发者ID:lahaxearnaud,项目名称:laravel-token,代码行数:4,代码来源:Token.php

示例12: findDateColumns

 /**
  * Get any additional date columns for this model.
  *
  * @param Model $instance
  * @return array
  */
 protected function findDateColumns(Model $instance)
 {
     return array_values(array_diff($instance->getDates(), ['created_at', 'updated_at', 'deleted_at']));
 }
开发者ID:parsnick,项目名称:eloquentjs,代码行数:10,代码来源:Inspector.php

示例13: getDates

 /**
  * Get the attributes that should be converted to dates.
  *
  * @return array
  */
 public function getDates()
 {
     return array_merge(parent::getDates(), array('last_attempt_at', 'suspended_at', 'banned_at'));
 }
开发者ID:peintune,项目名称:Ternado,代码行数:9,代码来源:Throttle.php

示例14: __construct

 /**
  * View model constructor.
  *
  * @param Model $model
  * @return ViewModel
  */
 public function __construct(Model $model)
 {
     $this->model = $model;
     $this->dates = array_merge($this->dates, $model->getDates());
     $this->buildRelations();
 }
开发者ID:artissant,项目名称:laravel,代码行数:12,代码来源:ViewModel.php

示例15: getDates

	/**
	 * Get the attributes that should be converted to dates.
	 *
	 * @return array
	 */
	public function getDates()
	{
		return array_merge(parent::getDates(), array('activated_at', 'last_login'));
	}
开发者ID:pcerbino,项目名称:falcionevega,代码行数:9,代码来源:User.php


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