Ejemplo n.º 1
0
 /**
  * Runs the seeding operations.
  */
 public function run()
 {
     $metrics = $this->getSeedData();
     foreach ($metrics as $metric) {
         $this->metric->model()->create($metric);
     }
 }
Ejemplo n.º 2
0
 /**
  * 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);
     }
 }