/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $lexer = new Lexer(new LexerConfig());
     $interpreter = new Interpreter();
     $interpreter->addObserver(function (array $row) {
         $peak = new \App\Peak();
         $peak->created_at = Carbon\Carbon::now()->toDateTimeString();
         $peak->updated_at = Carbon\Carbon::now()->toDateTimeString();
         $peak->name = $row[0];
         $peak->elevation = $row[1];
         $peak->prominence = $row[2];
         $peak->state = $row[3];
         $peak->location = $row[4];
         $peak->range = $row[5];
         $peak->forecast_link = $row[6];
         $peak->description_link = $row[7];
         $peak->save();
     });
     $peakscsv = database_path() . '/seeds/peaks.csv';
     $lexer->parse($peakscsv, $interpreter);
 }
 /**
  * Responds to requests to GET /hikes/edit/{id}
  */
 public function getEdit($id = null)
 {
     $hike = \App\Hike::with('peaks')->find($id);
     if (is_null($hike)) {
         \Session::flash('flash_message', 'Hike not found.');
         return redirect('/hikes');
     }
     // get peak list
     $peakModel = new \App\Peak();
     $peak_list = $peakModel->getPeakList();
     // Create a simple array of just the peaks associated with this hike;
     // will be used in the view to decide which peaks should be checked off
     $peaks_for_this_hike = [];
     foreach ($hike->peaks as $peak) {
         $peaks_for_this_hike[] .= $peak->id;
     }
     return view('hikes.edit')->with(['hike' => $hike, 'peak_list' => $peak_list, 'peaks_for_this_hike' => $peaks_for_this_hike]);
 }