錯(cuò)誤:存儲(chǔ)數(shù)據(jù)時(shí)“不允許序列化閉包”。我在文本區(qū)域上使用 CKEditor。當(dāng)沒(méi)有更多文本時(shí),數(shù)據(jù)會(huì)被存儲(chǔ),但當(dāng)有更多文本(如第一個(gè)問(wèn)題)并且在https://www.lipsum.com上得到回答時(shí) ,則會(huì)在保存數(shù)據(jù)時(shí)顯示錯(cuò)誤。存儲(chǔ)功能public function store(Request $request){ $this->validate($request, [ 'noticeTitle' => 'required', 'noticeDesc' => 'required', ]); $notice = new Notice; $notice->noticeTitle = $request->input('noticeTitle'); $notice->noticeDesc = $request->input('noticeDesc'); $notice->batch_id = $request->input('targetedGroup'); if($request->hasFile('add_file')) { $noticeTitle = $request->input('noticeTitle'); $filename = $request->add_file->getClientOriginalName(); $request->add_file->storeAs('public/noticeFile/additionalFiles', $noticeTitle.'_'.$filename); $path = $noticeTitle.'_'.$filename; $notice->file = $path; } dd($notice); try{ $notice->save(); Session::flash('success', 'Notice Saved'); return redirect()->route('notice.index'); } catch (\Throwable $th){ Session::flash('danger', $th); return redirect()->route('notice.index'); }}$notice 變量的轉(zhuǎn)儲(chǔ)如下"noticeTitle" => "Lorem Ipsum Notice New" "noticeDesc" => """ <h2>What is Lorem Ipsum?</h2> <p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ? """ "batch_id" => "3" "file" => "Lorem Ipsum Notice New_s.pdf" ]
1 回答

HUWWW
TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個(gè)贊
解決了。問(wèn)題不在于商店功能,而在于遷移。對(duì)于 CKEditor 上的數(shù)據(jù),我使用的是string
on migration。改了text
之后問(wèn)題就解決了。
- 1 回答
- 0 關(guān)注
- 122 瀏覽
添加回答
舉報(bào)
0/150
提交
取消