Add daily emails and archive
This commit is contained in:
parent
7ec664a810
commit
e2b6832598
379 changed files with 11132 additions and 0 deletions
28
source/_daily_emails/2023-04-23.md
Normal file
28
source/_daily_emails/2023-04-23.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: >
|
||||
Laravel Pipelines
|
||||
pubDate: 2023-04-23
|
||||
permalink: >-
|
||||
archive/2023/04/23/laravel-pipelines
|
||||
tags:
|
||||
- php
|
||||
- laravel
|
||||
---
|
||||
|
||||
I've seen a lot on social media and posts and videos recently about Laravel Pipelines - functionality that's been present in Laravel and used within the framework for some time - but there was only documentation added for it last month as part of the Laravel 10 release.
|
||||
|
||||
This is an example from the new documentation:
|
||||
|
||||
```php
|
||||
$user = Pipeline::send($user)
|
||||
->through([
|
||||
GenerateProfilePhoto::class,
|
||||
ActivateSubscription::class,
|
||||
SendWelcomeEmail::class,
|
||||
])
|
||||
->then(fn (User $user) => $user);
|
||||
```
|
||||
|
||||
Once a user has registered, it is passed through different classes - each performing a task and calling the next class in the list, similar to middleware. Once finished, a final action is performed or a value is returned.
|
||||
|
||||
As someone who doesn't use Laravel often but does use standalone components - like `illuminate/collections` - in other PHP projects, I'm interested to see how I can use this via `illuminate/pipeline` to refactor some of my existing code.
|
Loading…
Add table
Add a link
Reference in a new issue