Ejemplo n.º 1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $club = getClub($id, 'admin::clubs');
     ClubPost::where('club_id', $club->id)->delete();
     Club::destroy($club->id);
     return Redirect::route('admin::clubs')->with('success', 'The club has been deleted');
 }
Ejemplo n.º 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  *
  * @return mixed
  */
 public function destroy($id)
 {
     $canBeDeleted = empty(Club::find($id)->teams->toArray());
     if ($canBeDeleted) {
         Club::destroy($id);
         \Flash::success('Club deleted!');
     } else {
         \Flash::error('Cannot delete because they are existing teams in this club.');
     }
     return redirect('admin/data-management/clubs');
 }