public function destroy($id) { $type = Type::find($id); $type->attributes()->detach(); // Need to reset all subjects that use this type via foreign key // Had better make a warning message to explain that this will // happen and have the user confirm $subjects = Subject::where('type_id', '=', $id)->update(array('type_id' => 1)); $type->delete(); Session::flash('message', 'Type deleted.'); return Redirect::back(); }