zilong %!s(int64=4) %!d(string=hai) anos
pai
achega
7f2b90f805
Modificáronse 1 ficheiros con 11 adicións e 1 borrados
  1. 11 1
      app/Models/ServicePack.php

+ 11 - 1
app/Models/ServicePack.php

xqd xqd
@@ -10,7 +10,7 @@ namespace App\Models;
 
 class ServicePack extends BaseModel
 {
-    protected $appends = ['label_texts'];
+    protected $appends = ['label_texts', 'service_pack_protocol'];
     protected $table = 'service_packs';
     protected $casts = [
         'label' => 'json',
@@ -32,4 +32,14 @@ class ServicePack extends BaseModel
     public function systemconfig(){
         return $this->hasOne(SystemConfig::class,'id','agreement_id');
     }
+
+    public function getServicePackProtocolAttribute()
+    {
+        $data = '';
+        if (!empty($this->agreement_id)) {
+            $data = SystemConfig::where('id', $this->agreement_id)->value('value');
+        }
+
+        return $data;
+    }
 }