當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model::getHidden方法代碼示例

本文整理匯總了PHP中Illuminate\Database\Eloquent\Model::getHidden方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::getHidden方法的具體用法?PHP Model::getHidden怎麽用?PHP Model::getHidden使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Database\Eloquent\Model的用法示例。


在下文中一共展示了Model::getHidden方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Create new instance of eloquent type.
  *
  * @param Model $model
  */
 public function __construct(Model $model, $name = '')
 {
     $this->name = $name;
     $this->fields = collect();
     $this->hiddenFields = collect($model->getHidden())->flip();
     $this->model = $model;
     $this->camelCase = config('relay.camel_case', false);
 }
開發者ID:nuwave,項目名稱:laravel-graphql-relay,代碼行數:13,代碼來源:EloquentType.php

示例2: castModel

 /**
  * Get an array representing the properties of a model.
  *
  * @param  \Illuminate\Database\Eloquent\Model  $model
  * @return array
  */
 public static function castModel(Model $model)
 {
     $attributes = array_merge($model->getAttributes(), $model->getRelations());
     $visible = array_flip($model->getVisible() ?: array_diff(array_keys($attributes), $model->getHidden()));
     $results = [];
     foreach (array_intersect_key($attributes, $visible) as $key => $value) {
         $results[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED) . $key] = $value;
     }
     return $results;
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:16,代碼來源:IlluminateCaster.php

示例3: process

 /**
  * Applies processing to a single model
  *
  * @param Model $model
  * @return Model
  */
 public function process(Model $model)
 {
     $hiddenOnModel = $model->getHidden();
     foreach ($this->unhidden as $unhidden) {
         if (($key = array_search($unhidden, $hiddenOnModel)) !== false) {
             unset($hiddenOnModel[$key]);
         }
     }
     $hiddenOnModel = array_merge($hiddenOnModel, $this->hidden);
     $model->setHidden($hiddenOnModel);
     return $model;
 }
開發者ID:czim,項目名稱:laravel-repository,代碼行數:18,代碼來源:ApplyExtraHiddenAndVisibleAttributes.php

示例4: getVisibleIndexCasts

 /**
  * Get the visible model casts for the index.
  *
  * @param  \Illuminate\Database\Eloquent\Model $model
  * @return array
  */
 protected function getVisibleIndexCasts(BaseModel $model)
 {
     if (count($model->getVisible()) > 0) {
         return array_intersect_key($model->getCasts(), array_flip($model->getVisible()));
     }
     return array_diff_key($model->getCasts(), array_flip($model->getHidden()));
 }
開發者ID:elodex,項目名稱:elodex,代碼行數:13,代碼來源:IndexMapping.php

示例5: __construct

 /**
  * ModelSnapshot constructor.
  *
  * @param Model $model
  * @param string $event
  */
 protected function __construct(Model $model, $event)
 {
     $this->model = $model->makeVisible($model->getHidden());
     $this->event = $event;
 }
開發者ID:cklmercer,項目名稱:laravel-model-time-machine,代碼行數:11,代碼來源:SnapShotFactory.php


注:本文中的Illuminate\Database\Eloquent\Model::getHidden方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。