[ 'name' => '【小程序】查看会员权益广告位', 'dimensions'=> '710*382', 'is_show' => true, 'ads' => [ ['image' => 'https://zcs-test.oss-cn-chengdu.aliyuncs.com/ac/is_vip.png', 'sort' => 1, 'jump_type' => 0, 'is_show' => 1 , 'name' => 1] ] ], 'wechat_mini_become_vip_banner'=> [ 'name' => '【小程序】成为会员广告位', 'dimensions'=> '710*382', 'is_show' => true, 'ads' => [ ['image' => 'https://zcs-test.oss-cn-chengdu.aliyuncs.com/ac/not_vip.jpg', 'sort' => 1, 'jump_type' => 0, 'is_show' => 1 , 'name' => 1] ] ], 'wechat_mini_store_online' => [ 'name' => '【小程序】线上预约店', 'dimensions' => '640*320', 'is_show' => true, 'ads' => [ ['image' => 'https://via.placeholder.com/640x320.png', 'sort' => 1, 'jump_type' => 0, 'is_show' => 1 , 'name' => 1] ] ] ] as $key => $values) { $address = AdAddress::firstOrCreate(['key' => $key], Arr::except($values, ['ads'])); if (isset($values['ads'])) { $address->ads()->createMany($values['ads']); } } } }