1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace app\model;
- use app\event\Msg;
- use think\Model;
- use app\model\TalkskillComment;
- use app\model\TalkskillLabel;
- class Talkskill extends Model
- {
- public function getLabelAttr($value)
- {
- if (empty($value)) return $value;
- $label = TalkskillLabel::where('id', 'in', $value)->column('label_name');
- $label = implode('#', $label);
- return '#' . $label;
- }
- public function getImgsAttr($value)
- {
- if (empty($value)) return $value;
- $arr = explode(',', $value);
- $domain = config('app.ali_oss_bindurl');
- foreach ($arr as &$item) {
- $item = 'https://' . $domain . '/' . $item;
- }
- return $arr;
- }
- public function getVideosAttr($value)
- {
- if (empty($value)) return $value;
- $arr = explode(',', $value);
- $domain = config('app.ali_oss_bindurl');
- foreach ($arr as &$item) {
- $item = 'https://' . $domain . '/' . $item;
- }
- return $arr;
- }
- public function employee()
- {
- return $this->belongsTo(Employee::class, 'employee_id')->bind(['name']);
- }
- public function aproveName()
- {
- return $this->belongsTo(Employee::class, 'aprove_employee_id')->bind(['aprove_name' => 'name']);
- }
- public function TalkskillComment()
- {
- return $this->hasMany(TalkskillComment::class, 'taid', 'id');
- }
- public function getMediaIdAttr($value)
- {
- if (empty($value)) return '';
- $arr = explode(',', $value);
- return $arr;
- }
- public function getWeixinMediaAttr($value)
- {
- if (empty($value)) return '';
- $arr = explode(',', $value);
- return $arr;
- }
- public function approveEmployee()
- {
- return $this->belongsTo(Employee::class, 'aprove_employee_id')->bind(['approve_name'=>'name','opt_name']);
- }
- public function employees()
- {
- return $this->belongsTo(Employee::class, 'employee_id');
- }
- }
|