См. также: Illuminate\Database\Eloquent\Model
См. также: Esensi\Model\Contracts\EncryptingModelInterface
См. также: Esensi\Model\Contracts\HashingModelInterface
См. также: Esensi\Model\Contracts\JugglingModelInterface
См. также: Esensi\Model\Contracts\PurgingModelInterface
См. также: Esensi\Model\Contracts\RelatingModelInterface
См. также: Esensi\Model\Contracts\ValidatingModelInterface
См. также: Illuminate\Contracts\Support\MessageProvider
Автор: Diego Caprioli (diego@emersonmedia.com)
Автор: Daniel LaBarge (daniel@emersonmedia.com)
Наследование: extends Illuminate\Database\Eloquent\Model, implements Esensi\Model\Contracts\EncryptingModelInterface, implements Esensi\Model\Contracts\HashingModelInterface, implements Esensi\Model\Contracts\JugglingModelInterface, implements Illuminate\Contracts\Support\MessageProvider, implements Esensi\Model\Contracts\PurgingModelInterface, implements Esensi\Model\Contracts\RelatingModelInterface, implements Esensi\Model\Contracts\ValidatingModelInterface, use trait Esensi\Model\Traits\ValidatingModelTrait, use trait Esensi\Model\Traits\EncryptingModelTrait, use trait Esensi\Model\Traits\HashingModelTrait, use trait Esensi\Model\Traits\JugglingModelTrait, use trait Esensi\Model\Traits\PurgingModelTrait, use trait Esensi\Model\Traits\RelatingModelTrait
Пример #1
0
 /**
  * Create a new model instance
  *
  * @return ModelHashingStub
  */
 public function __construct()
 {
     parent::__construct();
     // Assign a default hasher for mocking purposes
     $this->hasher = new BcryptHasher();
 }
Пример #2
0
 /**
  * Dynamically retrieve attributes.
  *
  * @param  string $key
  * @return mixed
  */
 public function __get($key)
 {
     // Dynamically get time since attributes
     $normalized = Str::snake($key);
     $attribute = str_replace(['time_since_', 'time_till_'], ['', ''], $normalized);
     if ((Str::startsWith($normalized, 'time_since_') || Str::startsWith($normalized, 'time_till_')) && in_array($attribute . '_at', $this->getDates())) {
         // Convert the attribute to a Carbon date
         $value = $this->getAttributeFromArray($attribute . '_at');
         // Show label if date has not been set
         if (is_null($value)) {
             return Lang::get('esensi/core::core.labels.never_' . $attribute);
         }
         // Show human readable date
         $date = $this->asDateTime($value);
         return $date->diffForHumans();
     }
     // Default dynamic getter
     return parent::__get($key);
 }
Пример #3
0
 /**
  * Create a new model instance.
  *
  * @return ModelEncryptingStub
  */
 public function __construct()
 {
     parent::__construct();
     // Assign a default encrypter for mocking purposes
     $this->encrypter = EncrypterStub::newInstance();
 }
 public function getDates()
 {
     return array_merge(parent::getDates(), 'start_time', 'end_time');
 }