Laravel 8 Arr::get() {#collection-method}
Arr::get
函数使用「.」符号从深度嵌套的数组根据指定键检索值:
use Illuminate\Support\Arr;
$array = ['products' => ['desk' => ['price' => 100]]];
$price = Arr::get($array, 'products.desk.price');
// 100
Arr::get
函数也可以接受一个默认值,如果没有找到特定的键,将返回默认值:
use Illuminate\Support\Arr;
$discount = Arr::get($array, 'products.desk.discount', 0);
// 0