jeudi 16 juin 2016

laravel set class variable value

i'm going to store data through excel-sheet to database every thing is going well but i want to add user->ID individually in Item class there is field in item class Userid

public function import()
    {
        Excel::load(Input::file('fileitem'),function($reader){
            $reader->each(function($sheet){
                Item::firstOrCreate($sheet->toArray());
                 $this->userid =Auth::user()->id;
            });
        });
        return back()->with('message','Records added sucessfully');;
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire