diff --git a/app/Models/Course.php b/app/Models/Course.php index 63d0e69..77c4bb8 100755 --- a/app/Models/Course.php +++ b/app/Models/Course.php @@ -9,10 +9,50 @@ use Illuminate\Filesystem\Filesystem; class Course extends SoftDeletesModel { - protected $appends = ['date_status', 'publicize', 'sign_date_status', 'qrcode', 'teacher_detail']; + protected $appends = [ + 'date_status', 'publicize', 'sign_date_status', 'qrcode', 'teacher_detail', + 'status_text', 'is_fee_text', 'is_arrange_text', 'show_txl_text', 'show_mobile_text', 'auto_schoolmate_text' + ]; protected $casts = ['publicize_ids' => 'json']; + public function getStatusTextAttribute() + { + $array = [0 => '待发布', 1 => '已发布']; + return $array[$this->attributes['status']]; + } + + public function getIsFeeTextAttribute() + { + $array = [0 => '免费', 1 => '收费']; + return $array[$this->attributes['is_fee']]; + } + + public function getIsArrangeTextAttribute() + { + $array = [0 => '否', 1 => '是']; + return $array[$this->attributes['is_arrange']]; + } + + public function getShowTxlTextAttribute() + { + $array = [0 => '否', 1 => '是']; + return $array[$this->attributes['show_txl']]; + } + + public function getShowMobileTextAttribute() + { + $array = [0 => '否', 1 => '是']; + return $array[$this->attributes['show_mobile']]; + } + + public function getAutoSchoolmateTextAttribute() + { + $array = [0 => '否', 1 => '是']; + return $array[$this->attributes['auto_schoolmate']]; + } + + public function getQrcodeAttribute($value) { return $this->getCourseQrcode($this->attributes['id']);