Skip to content

Commit

Permalink
Adding Pipeline Facade to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewatts committed Mar 8, 2024
1 parent b20f36b commit da0c406
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,28 @@ App::get('/', function($request) {
});
```

### Pipeline Facade

__NOTE: See [Pipeline Support Class](#pipeline-support-class) section for a detailed example.__

```php
App::get('/', function ($request) {
// 4. Define the pipeline
$result = (new Pipeline(App::getContainer()))
->send($request)
->through([
PrepareRequest::class,
ValidateRequest::class,
TransformRequest::class,
SaveRequest::class,
])
->thenReturn();

// 5. Respond with the processed data
return response()->json(['result' => $result])->get();
});
```

## Helper functions

### response()
Expand Down

0 comments on commit da0c406

Please sign in to comment.