public function deleteAllBlocksExcept($blocks_to_keep) { $height_to_keep = $this->findLatestBlockHeight() - $blocks_to_keep; $affected_rows = Block::where('height', '<=', $height_to_keep)->delete(); return; }
/** * remove a block * * @return Redirect */ protected function postRemoveBlock(Request $request, $id) { $block = Block::where('id', $id)->firstOrFail(); $questionaire = $block->questionaire()->get()->first(); $this->authorize('questionaire-block-edit', $questionaire); $this->removeBlock($block, $request); return Redirect::action('Observation\\QuestionaireController@getBlocks', $questionaire->id)->with('status', 'Removed'); }