12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\model;
- use think\Model;
- class Lecturer extends Model
- {
- public function company(){
- return $this->hasOne(LecturerCompany::class, 'id','lecturer_company_id');
- }
- /**
- * 图片拼接
- */
- public function getPhotoAttr($value)
- {
- if (empty($value)) return $value;
- $ali_oss_bindurl = config('app.ali_oss_bindurl');
- $url = 'https://' . $ali_oss_bindurl . '/' . $value;
- return $url;
- }
- /**
- * 图片拼接
- */
- public function getPosterAttr($value)
- {
- if (empty($value)) return $value;
- $ali_oss_bindurl = config('app.ali_oss_bindurl');
- $url = 'https://' . $ali_oss_bindurl . '/' . $value;
- return $url;
- }
- /**
- * 图片拼接
- */
- public function getAddtimeAttr($value)
- {
- if (empty($value)) return $value;
- $value = date('Y-m-d',$value);
- return $value;
- }
- public function setPosterAttr($value){
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://'.$domain.'/';
- return str_replace($search, '', $value);
- }
- public function setPhotoAttr($value){
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://'.$domain.'/';
- return str_replace($search, '', $value);
- }
- //讲师课程
- public function train(){
- return $this->hasMany(TrainClass::class,'lecturer_id','id');
- }
- }
|