public function store(Request $post)
{
$validated = $post->validate(['eId'=>'required','about'=>'required']);
$edocsId = $post->id;
if($edocsId){
$edocs = Edocs::find($edocsId);
if($post->hasFile('scan')){
$file = time().'.'.$post->scan->extension();
$post->scan->storeAs('public/uploads/images',$file);
$edocs->scan = 'storage/uploads/images/'.$file;
}
}else{
$file = time().'.'.$post->scan->extension();
$post->scan->storeAs('public/uploads/images',$file);
$edocs = new Edocs;
$edocs->scan = 'storage/uploads/images/'.$file;
}
$edocs->eId = $post->eId;
$edocs->about = $post->about;
$edocs->user_id = Auth::user()->id;
$edocs->save();
return response()->json($edocs);
}
Выдает эту ошибку при редактировании: Call to a member function extension() on null
, выдает поле картинки пустым