我有一个$sizes
这样的集合:
$sizes =
collect([
10 => 'xl',
11 => 'xxl',
12 => 'xxxl'
]);
这样的$colors
集合:
$colors =
collect([
20 => 'red',
21 => 'green',
22 => 'blue'
]);
现在我想创建这样的组合:
$result =
collect([
[10 => 'xl' , 20 => 'red'],
[10 => 'xl' , 21 => 'green'],
[10 => 'xl' , 22 => 'blue'],
[11 => 'xxl' , 20 => 'red'],
[11 => 'xxl' , 21 => 'green'],
[11 => 'xxl' , 22 => 'blue'],
[12 => 'xxxl' , 20 => 'red'],
[12 => 'xxxl' , 21 => 'green'],
[12 => 'xxxl' , 22 => 'blue']
]);
我怎样才能在laravel中做到这一点?