/** * Runs the seeding operations. */ public function run() { $metrics = $this->getSeedData(); foreach ($metrics as $metric) { $this->metric->model()->create($metric); } }
/** * Updates the specified metric. * * @param int|string $id * * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ public function destroy($id) { $metric = $this->metric->model()->findOrFail($id); if ($metric->delete()) { $message = 'Successfully deleted metric.'; return redirect()->route('maintenance.metrics.index')->withSuccess($message); } else { $message = 'There was an issue deleting this metric. Please try again.'; return redirect()->route('maintenance.metrics.edit', [$id])->withSuccess($message); } }