PHP code example of henzeb / laravel-pipeline-factory
1. Go to this page and download the library: Download henzeb/laravel-pipeline-factory library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
henzeb / laravel-pipeline-factory example snippets
use Illuminate\Support\Facades\Pipeline;
use Henzeb\Pipeline\Facades\Pipe;
use App\Models\User;
$user = User::find(1);
Pipeline::send($user)
->through(
Pipe::events(
Pipe::unless(
UserEnteredPasswordTwice::class,
ReturnInvalidRequestResponse::class
)->else(
Pipe::rescue(
Pipe::transaction(
[
UpdateUser::class,
UpdateAddress::class
]
),
ReturnFailureResponse::class,
)
),
'updateUserDetails'
)
)