public function store(Request $request, $productid, $layerid) { $data = $this->getData($request, $productid, $layerid); $data['created_at'] = time(); ProductConModel::create($data); return redirect(DOMAIN . 'admin/' . $productid . '/' . $layerid . '/proCon'); }
/** * 初始化一条内容 */ public function initCon($productid, $layerid) { $data = ['productid' => $productid, 'layerid' => $layerid, 'genre' => 1, 'pic_id' => 1, 'name' => '', 'created_at' => time()]; ProductConModel::create($data); $conModel = ProductConModel::where($data)->first(); return $conModel; }
/** * 收集内容数据 */ public function getConData($pid, $layerid, $newpid, $layerNewId) { $conModel = ProductConModel::where('productid', $pid)->where('layerid', $layerid)->first(); $data = ['productid' => $newpid, 'layerid' => $layerNewId, 'genre' => $conModel->genre, 'pic_id' => $conModel->pic_id, 'name' => $conModel->name, 'created_at' => time(), 'record' => 0]; ProductConModel::create($data); }