![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/corals-api/Corals/core/Foundation/Models/ |
<?php namespace Corals\Foundation\Models; use Corals\Foundation\Traits\BaseRelations; use Corals\Foundation\Traits\HashTrait; use Corals\Foundation\Traits\Hookable; use Corals\Foundation\Traits\Language\Translatable; use Corals\Foundation\Traits\ModelActionsTrait; use Corals\Foundation\Traits\ModelHelpersTrait; use Corals\Foundation\Traits\ModelPropertiesTrait; use Corals\Settings\Traits\CustomFieldsModelTrait; use Corals\Settings\Traits\HasSettings; use Illuminate\Database\Eloquent\Model; use Yajra\Auditable\AuditableTrait; class BaseModel extends Model { use HashTrait, AuditableTrait, Hookable, CustomFieldsModelTrait, ModelHelpersTrait, ModelActionsTrait, Translatable, HasSettings, BaseRelations, ModelPropertiesTrait; public $allowPublicSearch = false; protected static $logAttributes = ['*']; protected static $logAttributesToIgnore = ['id', 'updated_at', 'created_at', 'deleted_at']; protected static $logOnlyDirty = true; protected static function boot() { parent::boot(); } /** * BaseModel constructor. * @param array $attributes */ public function __construct(array $attributes = []) { $this->initialize(); return parent::__construct($attributes); } /** * init model */ public function initialize() { $config = config($this->config); if ($config) { if (isset($config['presenter'])) { $this->setPresenter(new $config['presenter']); unset($config['presenter']); } foreach ($config as $key => $val) { if (property_exists(get_called_class(), $key)) { $this->$key = $val; } } } } /** * @return string */ public function getThumbnailAttribute() { $media = $this->getFirstMedia($this->mediaCollectionName); if ($media) { return $media->getFullUrl(); } elseif ($thumbnailLink = $this->getProperty('thumbnail_link')) { return $thumbnailLink; } else { return asset(config($this->config . '.default_image')); } } public function saveQuietly(array $options = []) { return static::withoutEvents(function () use ($options) { return $this->save($options); }); } protected function isGuardableColumn($key) { return parent::isGuardableColumn($key) || $this->hasSetMutator($key); } public function AggregatedRatingParentModel() { return null; } }