Last active
February 15, 2022 10:05
-
-
Save guanguans/8611f008d555c39a08d22a8128c5fb39 to your computer and use it in GitHub Desktop.
#diffIds #verify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $diffIds = \Illuminate\Support\Str::of($inputStrIds = '1,2,5, ') | |
| ->trim()->trim(',')->trim() | |
| ->explode(',') | |
| ->filter(function ($value){ | |
| return filled($value); | |
| }) | |
| ->map(function ($item){ | |
| return trim($item); | |
| }) | |
| ->pipe(function (\Illuminate\Support\Collection $inputArrIds): \Illuminate\Support\Collection{ | |
| $dbIds = ['1', '2', '3']; | |
| return $inputArrIds->diff($inputArrIds->intersect($dbIds)); | |
| }) | |
| ->dd(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment