- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 132
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Relevant Article: https://martinjoo.dev/laravel-pipelines
Illuminate pipelines look like:
app(Pipeline::class)
    ->send('<p>This is the HTML content of a blog post</p>')
    ->through([
        ModerateContent::class,
        RemoveScriptTags::class,
        MinifyHtml::class,
    ])
    ->then(function (string $content) {
        return Post::create([
            'content' => $content,
            ...
        ]);
    });In the example above, the string $content variable "travels" the pipeline. The signature of each class that it travels through needs to be
public class ModerateContent
{
    public function handle(/* our traveler */ string $content, Closure $next)
    {
        $safeContent = $this->removeBadWords($content);
        $next($safeContent);
    }
}As you can see, the syntax is fairly similar to the existing Laravel Actions handler. In fact, all I need to do is change the signature to ?Closure $next = null to adapt it for both usages. However, it would be quite neat if Actions could support this directly (the return value of the handler function would be passed to $next in this case).
lucascaires and GregoireGaonach
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request