app/Http/Controllers/admin/OrdersController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        $data = $request -> all();
        $orders = Orders::find($id);
        $orders -> recipients = $data['recipients'];
        $orders -> gid = $data['gid'];
        $orders -> num = $data['num'];
        $orders -> address = $data['address'];
        $orders -> phone = $data['phone'];
        $res = $orders -> save();
        if ($res) {
            return redirect('/admin/orders/index')-> with('success','修改成功');
        }else{
            return back()->with('error','修改失败');
        }
    }
public function update ( Request $ request , $ id ) { $ data = $ request -> all ( ) ; $ orders = Orders :: find ( $ id ) ; $ orders -> recipients = $ data [ 'recipients' ] ; $ orders -> gid = $ data [ 'gid' ] ; $ orders -> num = $ data [ 'num' ] ; $ orders -> address = $ data [ 'address' ] ; $ orders -> phone = $ data [ 'phone' ] ; $ res = $ orders -> save ( ) ; if ( $ res ) { return redirect ( '/admin/orders/index' ) -> with ( 'success' , '修改成功'); } else { return back ( ) -> with ( 'error' , '修改失败'); } }
Update the specified resource in storage.
Update the specified resource in storage .
//获取数据进行存到数据库 // dump($data); //判断添加订单是否成功