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


PHP Model::__get方法代码示例

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


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

示例1: __get

 public function __get($key)
 {
     if ($this->isEloquent()) {
         return $this->data->__get($key);
     }
     return object_get($this->data, $key);
 }
开发者ID:portonefive,项目名称:tabulator,代码行数:7,代码来源:Row.php

示例2: __get

 /**
  * Magic method to return the meta data like the post original fields
  * 
  * @param string $key
  * @return string
  */
 public function __get($key)
 {
     if (!isset($this->{$key})) {
         return $this->meta->{$key};
     }
     return parent::__get($key);
 }
开发者ID:chrsc,项目名称:corcel,代码行数:13,代码来源:Post.php

示例3: __get

 /**
  * {@inheritdoc}
  */
 public function __get($key)
 {
     if (array_key_exists($key, $this->aliases)) {
         $key = $this->aliases[$key];
     }
     return parent::__get($key);
 }
开发者ID:spyc,项目名称:elearn-model,代码行数:10,代码来源:Model.php

示例4: __get

 public function __get($key)
 {
     if (in_array($key, $this->translatable)) {
         return $this->getTranslatable($key);
     }
     return parent::__get($key);
 }
开发者ID:aewebsolutions,项目名称:laravel-translator,代码行数:7,代码来源:Model.php

示例5: __get

 /**
  * A hack to allow avatar_url to be called on the result of Auth::user().
  *
  * @param  string $key The variable to get
  * @return mixed
  */
 public function __get($key)
 {
     if ($key === 'avatar_url') {
         return $this->getPresenter()->avatar_url;
     }
     return parent::__get($key);
 }
开发者ID:gitter-badger,项目名称:deployer-2,代码行数:13,代码来源:User.php

示例6: __get

 public function __get($key)
 {
     // Получить армию.
     if ($key == 'army') {
         return $this->castle ? $this->castle->army : null;
     }
     return parent::__get($key);
 }
开发者ID:nvchernov,项目名称:tsargrad,代码行数:8,代码来源:User.php

示例7: __get

 public function __get($key)
 {
     if (array_key_exists($key, $this->personableAliases)) {
         return $this->{$this->personableAliases[$key]};
     } else {
         return parent::__get($key);
     }
 }
开发者ID:stevendesu,项目名称:reedsmetals.com,代码行数:8,代码来源:Employee.php

示例8: __get

 public function __get($key)
 {
     $columns = $this->getTableColumns();
     if (array_key_exists($key, $this->attributes) || $this->hasGetMutator($key) || $this->relationLoaded($key) || method_exists($this, $key) || in_array($key, $columns)) {
         return parent::__get($key);
     }
     return $this->getMeta($key);
 }
开发者ID:sukohi,项目名称:metaphor,代码行数:8,代码来源:MetaphorModel.php

示例9: __get

 public function __get($name)
 {
     switch ($name) {
         case 'fullname':
             return "{$this->name} {$this->last_name}";
             break;
     }
     return parent::__get($name);
 }
开发者ID:evelynohelia,项目名称:cayetano_encuestas,代码行数:9,代码来源:User.php

示例10: __get

 public function __get($key)
 {
     if ($key == 'email') {
         if ($this->employee != null) {
             return $this->employee->email;
         } else {
             return $this->getAttribute('email');
         }
     } else {
         return parent::__get($key);
     }
 }
开发者ID:stevendesu,项目名称:reedsmetals.com,代码行数:12,代码来源:FormRecipient.php

示例11: __get

 public function __get($key)
 {
     if ($key == 'imageURL') {
         return '/images/page/' . $this->page->id . '/' . $this->id . '.png';
     } else {
         if ($key == 'thumbURL') {
             return '/images/page/' . $this->page->id . '/' . $this->id . '.thumbnail.png';
         } else {
             return parent::__get($key);
         }
     }
 }
开发者ID:stevendesu,项目名称:reedsmetals.com,代码行数:12,代码来源:PageImage.php

示例12: __get

 public function __get($key)
 {
     if ($key == 'imageURL') {
         return '/images/slider/' . $this->slider->id . '/' . $this->id . '.png';
     } else {
         if ($key == 'thumbURL') {
             return '/images/slider/' . $this->slider->id . '/' . $this->id . '.thumbnail.png';
         } else {
             if ($key == 'height') {
                 return $this->image->height;
             } else {
                 return parent::__get($key);
             }
         }
     }
 }
开发者ID:stevendesu,项目名称:reedsmetals.com,代码行数:16,代码来源:SliderPanel.php

示例13: __get

 /**
  * Give the user access to the translated fields from the main model.
  *
  * @param string $key
  * @return mixed|null
  */
 public function __get($key)
 {
     if (!in_array($key, $this->translatable)) {
         return parent::__get($key);
     }
     return !empty($this->translations->first()) ? $this->translations->first()->getAttribute($key) : null;
 }
开发者ID:administrcms,项目名称:localization,代码行数:13,代码来源:Translatable.php

示例14: __get

 public function __get($key)
 {
     try {
         $class = get_class($this);
         if (isset($class::$relationsData) && array_key_exists($key, $class::$relationsData)) {
             if (!isset($this->relations[$key])) {
                 $relations = $this->{$key}();
                 $this->relations[$key] = $relations->getResults();
             }
             return $this->relations[$key];
         }
         return parent::__get($key);
     } catch (NullMorphException $e) {
         return null;
     }
 }
开发者ID:kevupton,项目名称:ethereal,代码行数:16,代码来源:Ethereal.php

示例15: __get

 public function __get($name)
 {
     if (preg_match('/pretty_(\\w+_at)/', $name, $matches)) {
         $field = $matches[1];
         $timestamp = $this->{$field};
         if ($timestamp and is_a($timestamp, \Carbon\Carbon::class)) {
             return $timestamp->format('Y-m-d H:i');
         }
     }
     return parent::__get($name);
 }
开发者ID:gez-studio,项目名称:gez-mall,代码行数:11,代码来源:Entity.php


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