/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Variable $variable, Request $request) { //delete data $variable->data()->delete(); //delete itself $variable->delete(); Cache::flush(); return redirect()->route('datasets.show', $variable->fk_dst_id)->with('message', 'Variable deleted.'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Variable $variable, Request $request) { //delete data foreach ($variable->data()->get()->all() as $varData) { $varData->delete(); $varData->time->delete(); } //delete itself $variable->delete(); Cache::flush(); return redirect()->route('datasets.show', $variable->fk_dst_id)->with('message', 'Variable deleted.'); }