Esempio n. 1
0
 public function delete($id)
 {
     if (Input::has('selected_band')) {
         return \Redirect::to('admin/bands/' . Input::get('selected_band') . '/delete');
     } else {
         if (Input::has('confirmed_delete')) {
             try {
                 //$band = Bands::where('id', '=', $id)->get();
                 $band = Bands::find($id);
                 Bands::where('id', '=', $id)->delete();
                 return View::make('admin.bands.delete', ['status' => 'successful', 'band' => $band, 'id' => $id]);
             } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
                 return View::make('admin.bands.delete', ['status' => 'unsuccessful', 'band' => $band, 'id' => $id]);
             }
         } else {
             $band = Bands::find($id);
             return View::make('admin.bands.delete', ['status' => 'confirm', 'band' => $band, 'id' => $id]);
         }
     }
 }