select('force_subscribe_type','resource_url')->first(); } public static function getSubscribeTypeByAppId($appid){ return ChannelSubscribeSetting::where('appid',$appid)->select('id','force_subscribe_type','resource_url')->first(); } /** * @param array $data * @return bool */ public static function updateOrSettingForceSubScribe(array $data){ if(empty($data['distribution_channel_id']) || empty($data['force_subscribe_type']) || empty($data['appid'])){ return false; } $old = self::getSubscribeTypeByAppId($data['appid']); if($old){ $old->force_subscribe_type = $data['force_subscribe_type']; if(isset($data['resource_url'])){ $old->resource_url = $data['resource_url']; } $old->save(); return true; }else{ ChannelSubscribeSetting::create($data); return true; } } }