![]() 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/ledger.corals.io/Corals/modules/CMS/Models/ |
<?php namespace Corals\Modules\CMS\Models; use Corals\Foundation\Traits\ModelPropertiesTrait; use Illuminate\Database\Eloquent\Builder; use Cviebrock\EloquentSluggable\Sluggable; class Testimonial extends Content { use Sluggable, ModelPropertiesTrait; public function getModuleName() { return 'CMS'; } protected static function boot() { parent::boot(); static::addGlobalScope('type', function (Builder $builder) { $builder->where('type', 'testimonial'); }); } /** * Model configuration. * @var string */ public $config = 'cms.models.testimonial'; public $mediaCollectionName = 'testimonial-author-image'; public function getImageAttribute() { $media = $this->getFirstMedia($this->mediaCollectionName); if ($media) { return $media->getFullUrl(); } else { return asset(config($this->config . '.default_image')); } } protected $table = 'posts'; protected $attributes = [ 'type' => 'testimonial' ]; protected $casts = [ 'properties' => 'json', ]; public function sluggable() { return [ 'slug' => [ 'source' => 'title', 'onUpdate' => true ] ]; } protected $fillable = ['title', 'content', 'published', 'published_at', 'type', 'properties', 'author_id']; }