Cleanup Exporter; use firstOrCreate for any missing data we can infer/setup defaults for

This commit is contained in:
Nabeel Shahzad
2018-03-22 12:43:58 -05:00
parent 9657e8bd40
commit fbfd71adcf
11 changed files with 58 additions and 49 deletions

View File

@@ -320,11 +320,9 @@ class FlightController extends Controller
public function export(Request $request)
{
$exporter = app(ExportService::class);
$path = storage_path('app/import/export_flight.csv');
$flights = $this->flightRepo->all();
$exporter->exportFlights($flights, $path);
$path = $exporter->exportFlights($flights);
return response()
->download($path, 'flights.csv', [
'content-type' => 'text/csv',