Не работает edit image . Выдает ошибку "Call to a member function extension() on null"

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);
}

Ответы (0 шт):