samedi 7 mai 2016

how to save data in two different tables of database using single form in laravel 5.2?anyone pl help me

my controller here two tables name storeData and 2nd is dataFile.

public function storeData(Requests $request){
    $data= new Data;
    $data->name = $request->input('name');
    $data->description = $request->input('description');
    $data->save();

        $datafile= new Datafile;
        $datafile->data_id = $request->input('data_id');
        $datafile->dataname= $request->input('$dataname');
        $datafile->save();
        return back;
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire