Chain operations with pipelines:
Basic Pipeline
$result = app(Pipeline::class)
->send($order)
->through([
ValidateOrder::class,
ApplyDiscount::class,
CalculateTax::class,
ProcessPayment::class,
])
->thenReturn();Pipe Class
class ApplyDiscount
{
public function handle($order, Closure $next)
{
$order->applyDiscount();
return $next($order);
}
}Custom Method
->via('process')
->through([...]);