diff --git a/app/Models/Calendar.php b/app/Models/Calendar.php index 6abc56e..172b6ba 100755 --- a/app/Models/Calendar.php +++ b/app/Models/Calendar.php @@ -9,6 +9,19 @@ use Illuminate\Support\Facades\Cache; class Calendar extends SoftDeletesModel { + protected $appends = ['is_publish_text','type_text']; + + public function getIsPublishTextAttribute() + { + return $this->attributes['is_publish'] == 1 ? '是' : '否'; + } + + public function getTypeTextAttribute() + { + $array = [1=>'课程', 3=>'自定义事件', 4=>'资讯']; + return $array[$this->attributes['type']] ?? ''; + } + public function course() { return $this->hasOne(Course::class, 'id', 'course_id');