fly 4 vuotta sitten
vanhempi
commit
9a700c24f8

+ 2 - 8
src/Controllers/CompanyAuth/Transformers/ActivityTransformer.php

@@ -36,13 +36,7 @@ class ActivityTransformer
 
     public function isShowInPage(int $activity_id, int $channel_id, $type = 'reader')
     {
-        $info = ActivitySwitch::where('activity_id', $activity_id)->where('distribution_channel_id', $channel_id)->first();;
-        if ($type == 'reader') {
-            return $info->is_reader_page_show;
-        }
-        if ($type == 'sign') {
-            return $info->is_sign_message_show;
-        }
-        return 1;
+        $info = ActivitySwitch::where('activity_id', $activity_id)->where('distribution_channel_id', $channel_id)->first();
+        return $info ? ($type == 'reader' ? $info->is_reader_page_show : ($type == 'sign' ? $info->is_sign_message_show : 1)) : 1;
     }
 }