public function store_subject(Request $request) { $EqualSubject = new EqualSubject(); $EqualSubject->equal_order_id = $request->equal_order_id; $EqualSubject->subject_name = $request->subject_name; $EqualSubject->subject_code = $request->subject_code; $EqualSubject->hours = $request->subject_hours; $EqualSubject->degree = $request->degree; $EqualSubject->max_degree = $request->max_degree; $EqualSubject->save(); // update uploaded files if (!empty(request('files'))) { OrderFile::whereIn('id', request('files'))->update(['ref_key' => 'order_equal_subjects', 'ref_value' => $EqualSubject->id]); } return redirect()->route('equal.add_subjects', $request->equal_order_id)->with('success', trans('orders::order.add_subject_success')); }