I'm utilizing the TinyMCE editor in my application. It functions correctly in my local environment, storing data as expected. However, in the live environment on cPanel, the editor data is not being saved. Even upon form submission, the data is not retained.
public function store(Request $request)
{
$validatedData = $request->validate([
'news_title' => 'required|string',
'permalink' => 'required|string|unique:news,permalink',
'short_description' => 'nullable',
'long_description' => 'nullable',
'featured_image' => 'nullable|string',
'active' => 'nullable|integer',
]);
if ($request->filled('categories')) {
$validatedData['categories'] = implode(',', $request->input('categories', []));
}
$logged_in_user = Auth::user();
$validatedData['created_by'] = $logged_in_user->id;
$news = News::create($validatedData);
$metaDescriptions = $request->only([
'_seo_title',
'_seo_tags',
'_seo_description',
'_alt',
'_tagline',
]);
$newsMeta = [];
foreach ($metaDescriptions as $option => $value) {
if ($value !== null) {
$newsMeta[] = [
'news_id' => $news->id,
'option' => $option,
'value' => $value,
'created_at' => now(),
'updated_at' => now(),
];
}
}
# Insert news meta descriptions in bulk
DB::table('news_meta')->insert($newsMeta);
return redirect()->route('news-reports.create')->with(['success' => 'News Created Successfully!']);
}