예제 #1
0
파일: Vehicle.php 프로젝트: xinray/html-css
    public function editSupply($supply){
        $validator = self::validator();
        if($validator->fails()){
            return back()->withErrors($validator->errors())->withInput();
        }

        DB::tansaction(function() use(&$supply) {
            $supply ->supply->update([
                'title' => request('title'),
                'images' => request('images'),
                'desc'  => request('desc'),
            ]);

            $supply->update(request()->all());
        });

        if ($supply != null ) {
            return redirect('user/supply');
        } else {
            return back()->withErrors('创建失败')->withInput();
        }

    }