I fill a SQL Table from a Request with Laravel Excel.
After this I do an Eloquent Statement to fill the values markt and period manually.
public function importall(Request $request)
{
$periode = $request->periode;
$markt = $request->markt;
Excel::import(new periodenImport(), $request->file); // Datei Import
/*
PlanspielData::where('periode', ' ')
->update(['periode' => $periode]); // Daten der Periode zuordnen
PlanspielData::where('markt', ' ')
->update(['markt' => $markt]); // Daten einem Markt zuordnen
*/
return redirect('/import')->with('success-upload', 'Sucess');
}
I want to pass more then the file from the Request to the newperiodenImport to delete the commented area with Planspieldata.
2
Answers
You don’t need to pass the request to anywhere, you can simply call
request()->input('X');
you can make a __construct in the class and pass data to it
example: