You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Admin\Forms;
use Dcat\Admin\Widgets\Form;use Symfony\Component\HttpFoundation\Response;use App\Models\v3\Store as StoreModel;use App\Models\v3\Goods as GoodsModel;use App\Models\v3\GoodsBanners as GoodsBannerModel;
class GoodsCopyForm extends Form{
/** * Handle the form request. * * @param array $input * * @return Response */ public function handle(array $input) { // 获取外部传递参数
$goodsId = $input['goods_id']; $storeIds= $input['store_ids'];// dd($storeIds);
$goods = GoodsModel::find($goodsId); $goodsBanners = GoodsBannerModel::where('goods_id',$goodsId)->get(); foreach($storeIds as $key =>$value){ $model = new GoodsModel(); $model = $goods; dd($model->toArray()); $model->store_id = $value; $model->name = $goods->name; }
return $this->success('修改成功', '/goods'); }
/** * Build a form here. */ public function form() { $id = $this->getKey(); $this->text('goods_id')->value($id); $stores = StoreModel::getStoreArray(); $this->multipleSelect('store_ids','选择店铺')->required()->options($stores); }
/** * The data of the form. * * @return array */ public function default() { return []; }
}
|