示例#1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     $timeslots = TimeSlot::where('dj', $id)->count();
     if ($timeslots > 0) {
         return redirect()->back()->with('error', 'Remove DJ from schedule before deleting.');
     }
     $dj = DJ::findOrFail($id);
     File::delete(public_path() . '/img/djs/' . $dj->picture);
     DJ::destroy($id);
     return redirect()->route('admin.djs.index')->with('success', 'DJ Deleted!');
 }