Installation
All you need to do to get started is add Laravel Pipeline to your composer dependencies.
composer require slashequip/laravel-pipeline
1
You can then begin to use the pipeline in your codebase
use SlashEquip\LaravelPipeline\Pipeline;
use Illuminate\Http\Request;
use App\Transports\NewUserTransporter;
use App\Pipes\StoreNewUser;
use App\Pipes\SendNewUserNotification;
use App\Pipes\AddNewUserToIntercom;
use App\Pipes\AddNewUserToOnboardingCampaign;
use App\Http\Resources\UserResource;
class CreateNewUserController
{
public function __invoke(Request $request)
{
$transport = NewUserTransporter::make()
->setRequestData($request);
Pipeline::make()
->send($transport)
->through(
new StoreNewUser(),
new SendNewUserNotification(),
new AddNewUserToIntercom(),
new AddNewUserToOnboardingCampaign(),
)
->deliver();
return new UserResource($transport->user);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29