app/Http/Controllers/admin/DiscussController.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 -> except(['_token']);
        $discuss = Discuss::find($id);
        $discuss->content=$data['content'];
        $res = $discuss->save();
        if($res){
            return redirect('/admin/discuss')->with('success','修改成功');
        }else{
            return back()->with('error','添加失败');
        }
    }
public function update ( Request $ request , $ id ) { $ data = $ request -> except ( [ '_token' ] ) ; $ discuss = Discuss :: find ( $ id ) ; $ discuss -> content = $ data [ 'content' ] ; $ res = $ discuss -> save ( ) ; if ( $ res ) { return redirect ( '/admin/discuss' ) -> with ( 'success' , '修改成功'); } else { return back ( ) -> with ( 'error' , '添加失败'); } }
Update the specified resource in storage.
Update the specified resource in storage .
//获取除token以外上传的数据 //执行修改 // $res = DB::table('jc_discuss')->where('id',$id)->update(['uid'=>$req['uid'],'gid'=>$req['gid'],'content'=>$req['content']]); // dump($res);