Streamlining Campaign Management in Landing: Duplicate and Delete Actions
The landing project is evolving to offer more refined campaign management capabilities. Users can now efficiently duplicate existing campaigns and remove obsolete ones directly from the campaign list, enhancing overall workflow efficiency.
Enhanced Campaign Control
This update introduces two key actions:
- Duplicate Campaign: Creates an identical copy of a selected campaign, including all content and settings, but resets statistics to zero. This feature streamlines the process of creating similar campaigns, saving significant time and effort.
- Delete Campaign: Allows users to remove campaigns that are no longer needed. This action includes a confirmation step and is limited to campaigns that haven't been sent, preventing accidental deletion of active campaigns.
Duplication Logic
The duplication process ensures that all aspects of the original campaign are replicated in the copy. This includes:
- Content duplication
- Resetting of statistics
- Email list relationship synchronization
- Appending a translated "(Copy)" suffix to the new campaign's title
Here's a simplified example of how the duplication might be implemented in PHP:
<?php
function duplicateCampaign(int $campaignId): Campaign
{
$originalCampaign = Campaign::find($campaignId);
$newCampaign = $originalCampaign->replicate();
$newCampaign->title = $originalCampaign->title . ' (Copy)';
$newCampaign->status = 'draft';
$newCampaign->save();
// Sync email list relationships
$newCampaign->emailLists()->sync($originalCampaign->emailLists()->pluck('id')->toArray());
return $newCampaign;
}
?>
This PHP code snippet demonstrates how a campaign can be duplicated. The replicate() method creates a copy of the original campaign, and the code then updates the title, resets the status, and synchronizes email list relationships.
Benefits
These new features offer several advantages:
- Time Savings: Duplicating campaigns is faster than creating new ones from scratch.
- Reduced Errors: Copying existing campaigns minimizes the risk of configuration errors.
- Improved Organization: Deleting old campaigns keeps the campaign list clean and manageable.
Conclusion
The addition of duplicate and delete actions to the campaign list in the landing project provides users with more control and flexibility. These features streamline campaign management, reduce errors, and improve overall efficiency.