Laravel PHP

Fixing Auto-Publishing in Laravel Project

We're working on a Laravel-based project, a landing page generator, where users can create and publish content. A recent update focused on ensuring the auto-publish feature for LinkedIn and Dev.to is reliably triggered.

The Problem

The core issue was that while the toggles for 'publish_on_linkedin' and 'publish_on_devto' correctly saved the desired publishing state to the Post model, the associated jobs responsible for actually publishing the content weren't being dispatched during post generation. This meant posts weren't automatically going live on the specified platforms.

The Solution

The fix involved modifying the post generation process to explicitly call the respective coordinator classes when the system publishes a post. Now, when a post is marked for publishing in brave mode, the appropriate publishing jobs are dispatched, ensuring the content reaches LinkedIn and Dev.to as intended.

Check the full article for more details about background job dispatching in Laravel.

Gerardo Ruiz

Gerardo Ruiz

Author

Share: