/**
  * Show the application welcome screen to the user.
  *
  * Here we grab all the ”harvests” from the `harvests` table
  * and use the data within to run the jobs to update.
  *
  * @return Response
  */
 public function index()
 {
     $harvests = Harvest::orderBy('resource', 'asc')->orderBy('action', 'asc')->get();
     $harvestsGroupedByResource = $harvests->groupBy('resource');
     $resources = $harvests->unique('resource');
     return view('dashboard', ['harvests' => $harvestsGroupedByResource, 'resources' => $resources]);
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $harvests = Harvest::orderBy('resource', 'asc')->orderBy('action', 'asc')->get(['resource', 'action', 'last_run_at']);
     foreach ($harvests as $harvest) {
         $lastRunAt = 'Not yet run';
         if ($harvest->last_run_at != null) {
             $lastRunAt = $harvest->last_run_at . ' (' . $harvest->last_run_at->diffForHumans() . ')';
         }
         $data[] = [$harvest->resource, $harvest->action, $lastRunAt];
     }
     $headers = ['Resource', 'Action', 'Last Run'];
     $this->table($headers, $data);
 }