12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App\Model\qw;
- use Illuminate\Database\Eloquent\Model;
- class QwCategory extends Model
- {
- public $table = "jm_qw_category";
- protected $appends = [
- 'department_desc' , 'pid_text'
- ];
- public $timestamps = false;
- /**
- * 部门描述
- */
- public function getDepartmentDescAttribute()
- {
- $department = QwDepartment::find($this->department_id);
- return $department->department_name ?? '';
- }
- /**
- * 父级分类
- */
- public function getPidTextAttribute()
- {
- $department = QwCategory::find($this->pid);
- return $department->category_name ?? '';
- }
- }
|