Laravel 8 Arr::pull() {#collection-method}
Arr::pull
函数从数组中返回指定键的值并删除此键值对:
use Illuminate\Support\Arr;
$array = ['name' => 'Desk', 'price' => 100];
$name = Arr::pull($array, 'name');
// $name: Desk
// $array: ['price' => 100]
默认值可以作为第三个参数传递给该方法,如果键不存在,则返回该值:
use Illuminate\Support\Arr;
$value = Arr::pull($array, $key, $default);