| xqd
@@ -10,6 +10,7 @@ namespace App\Models;
|
|
|
|
|
|
class ServicePack extends BaseModel
|
|
|
{
|
|
|
+ protected $appends = ['label_texts'];
|
|
|
protected $table = 'service_packs';
|
|
|
protected $casts = [
|
|
|
'label' => 'json',
|
| xqd
@@ -18,4 +19,17 @@ class ServicePack extends BaseModel
|
|
|
{
|
|
|
return $this->belongsTo(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;
|
|
|
+ }
|
|
|
}
|