/**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     if ($this->shows == null) {
         $this->shows = Show::orderBy('name', 'asc')->get();
     }
     $view->with('shows', $this->shows);
 }
 public function delete($id)
 {
     $show = Show::findOrFail($id);
     File::delete(public_path() . '/img/shows/' . $show->show_picture);
     File::delete(public_path() . '/img/slider/' . $show->slider_picture);
     Show::destroy($id);
     return redirect()->route('admin.shows.index')->with('success', 'Show Deleted!');
 }
 public function run()
 {
     // TestDummy::times(20)->create('App\Post');
     DB::table('schedule')->delete();
     $user = User::take(2)->get();
     $shows = Show::all();
     for ($day = 0; $day <= 6; $day++) {
         for ($hour = 1; $hour <= 24; $hour++) {
             $idIndex = ($hour - 1) % 4 < 2 ? 0 : 1;
             $show = $shows->random();
             $slot = new TimeSlot(['show' => $show->id, 'dj' => $user[$idIndex]->id, 'day' => $day, 'hour' => $hour]);
             $slot->save();
         }
     }
 }