Commit 42787f19 by Vladislav

#20414 Загрузка и синхронизация VCards

1 parent c1ebf045
......@@ -56,9 +56,11 @@ class GoalAdvertisement extends Pivot
protected $fillable = [
'external_id',
'goal_v_card_external_id',
'goal_sitelink_external_id',
'goal_ad_group_external_id',
'dictionary_campaign_external_id',
'goal_v_card_id',
'goal_sitelink_id',
'goal_ad_group_id',
'dictionary_campaign_id',
'advertisement_id',
......@@ -85,9 +87,11 @@ class GoalAdvertisement extends Pivot
'id',
'external_id',
'goal_v_card_external_id',
'goal_sitelink_external_id',
'goal_ad_group_external_id',
'dictionary_campaign_external_id',
'goal_v_card_id',
'goal_sitelink_id',
'goal_ad_group_id',
'dictionary_campaign_id',
'advertisement_id',
......
......@@ -99,4 +99,9 @@ class GoalSitelink extends Pivot
return $this->belongsTo(Sitelink::class, 'sitelink_id');
}
public function goalAdvertisements()
{
return $this->hasMany(GoalAdvertisement::class, 'goal_sitelink_id');
}
}
......@@ -108,4 +108,9 @@ class GoalVCard extends Pivot
return $this->belongsTo(DictionaryCampaign::class, 'dictionary_campaign_id');
}
public function goalAdvertisements()
{
return $this->hasMany(GoalAdvertisement::class, 'goal_v_card_id');
}
}
......@@ -78,6 +78,10 @@ class AddSitelinks extends DirectRequest
'reserve_create_at' => null,
]);
$goalSitelink->goalAdvertisements()->update([
'goal_sitelink_external_id' => $external_id,
]);
}
} catch (\Exception $e) {
Log::debug($e);
......
......@@ -80,6 +80,10 @@ class AddVCards extends DirectRequest
'reserve_create_at' => null,
]);
$goalVCard->goalAdvertisements()->update([
'goal_v_card_external_id' => $external_id,
]);
}
} catch (\Exception $e) {
Log::debug($e);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!