This commit is contained in:
f4ilji
2024-11-13 13:38:58 +05:00
parent 462680ba77
commit f091b29b63
22 changed files with 488 additions and 418 deletions
@@ -51,7 +51,8 @@ class CreatePost extends CreateRecord
{
$this->record->seo()->create($this->seoData);
$this->sendNotify($this->record, auth()->user());
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, Carbon::parse($this->record->publish_at)->timestamp);
$publish_date = ($this->record->publish_at > now()) ? Carbon::parse($this->record->publish_at)->timestamp : null;
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, $publish_date);
}
private function generateSeo(array $data) : array
@@ -268,6 +269,7 @@ class CreatePost extends CreateRecord
$post_id = $this->record->id;
dispatch(new CreateVkPost($title, $text, $images, $post_id, $publish_date));
}
}
@@ -36,7 +36,8 @@ class EditPost extends EditRecord
protected function afterSave(): void
{
$this->record->seo()->update($this->seoData);
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, Carbon::parse($this->record->publish_at)->timestamp);
$publish_date = ($this->record->publish_at > now()) ? Carbon::parse($this->record->publish_at)->timestamp : null;
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, $publish_date);
}
private function setPreviewText(array $data) : string|null