Can you please format your code snippets properly so that your post is actually readable?
Also, what URL are you visiting that gives you that error message?
The GET method is not supported for this route. Supported methods: PUT.
I am using classic ckeditor for my textarea field. i have configured the editor to upload an embedded image which it does. the problem is that when i submit the form i get the above error. Here is my route:
Route::put('posts/{post}/update',[PostController::class,'update'])->name('posts.update');
Here is the form:
@extends('posts.mastershow')
@section('title','Edit Post') @section('content')
update
@section('script')
ClassicEditor .create(document.querySelector('#body'), { ckfinder: { uploadUrl: "{{ route('ckeditor.upload', ['_token' => csrf_token()]) }}",
}
})
.catch(error => {
console.error(error);
});
` Here is the controller:
`
public function update(Request $request, Post $post){
if($request->hasFile('image')) {
// Get filename with extension
$filenameWithExt = $request->file('image')->getClientOriginalName();
// Get just filename
$filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
// Get just ext
$extension = $request->file('image')->getClientOriginalExtension();
//Filename to store
$fileNameToStore = $filename.'_'.time().'.'.$extension;
// Upload Image
$path = $request->file('image')->storeAs('public/images', $fileNameToStore);
} else {
$fileNameToStore = 'noimage.jpg';
}
$post->image = $fileNameToStore;
$post->update([
'title'=>$request->title,
'tag'=>$request->tag,
'body'=>$request->body,
'slug' => $request->slug,
'image'=> $fileNameToStore,
]);
$post->save();
return redirect('/');
}
`
Please or to participate in this conversation.