Van1310
218
6
Laravel

Call to a member function save() on array

Posted 1 month ago by Van1310

store a multiple record store in one column so i get error like this

here is my code

public function document_store(Request $request)
    {
        $data=Input::all();
        foreach($data['document'] as $files => $name)
        {
                if(!empty($name))
                {                           
                    $picName=$files . '.' . $name->getClientOriginalExtension();
                    $name->move(base_path() . '/public/training/document/'.$data['user_id'].'/',$picName);                

                    $document[] = new Document(array(
                        'user_id'=>$request->get('user_id'),
                        'doc_type' => $files,
                        'doc_path' => $picName,
                    ));
                    $document->save();
                    flash('Document Submited')->success();            
                    return \Redirect::back();                   
                }            
        }          
        // return $document; 
    }

Please sign in or create an account to participate in this conversation.