예제 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return mixed
  */
 public function destroy($id)
 {
     $team = Team::find($id);
     $canBeDeleted = empty($team->homeFixtures->toArray()) && empty($team->awayFixtures->toArray());
     if ($canBeDeleted) {
         Team::destroy($id);
         \Flash::success('Team deleted!');
     } else {
         \Flash::error('Cannot delete because they are existing fixtures for this team.');
     }
     return redirect('admin/data-management/teams');
 }