创建和更新记录时不允许序列化“关闭”

时间:2019-05-27 09:17:35

标签: php laravel

当我创建和更新记录时,“不允许序列化”关闭”会发生此错误

public function update(Request $request, $id){
    try{
        $validatedData = Validator::make($request->all(),[
            'amount' => 'required',
        ]);

        if($validatedData->fails())
        {
            return redirect()->back()->with(['add_error_message' => $validatedData]);
        }

        $class_id = $request->class;
        $enroll_id = $request->enroll_type;
        $payment_id = $request->payment_type;
        $amount = $request->amount;

        ClassWiseFee::where('id', $id)
            ->update([
                'class_id' => $class_id,
                'enrollment_id' => $enroll_id,
                'payment_id' => $payment_id,
                'amount' => $amount,
            ]);

        return redirect()->back()->with(['update_success' => 'Record update successfully']);
    }catch (\Exception $e){
    return redirect()->back()->with(['exception_error' => $e]);
    }
}

0 个答案:

没有答案