123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- /**
- * Created by PhpStorm.
- * User: zilongs
- * Date: 20-10-4
- * Time: 下午7:11
- */
- namespace App\Models;
- class ServicePack extends BaseModel
- {
- protected $appends = ['label_texts'];
- protected $table = 'service_packs';
- protected $casts = [
- 'label' => 'json',
- 'team_id' => 'json'
- ];
- public function team()
- {
- return $this->belongsToMany(Team::class);
- }
- public function getLabelTextsAttribute()
- {
- $data = [];
- if (!empty($this->label)) {
- $map = config('config.pack_label_map');
- foreach ($this->label as $k => $v) {
- $data[$k]['name'] = $map[$v]??'';
- }
- }
- return $data;
- }
- }
|