public function delete() { TodoItem::where('todo_list_id', $this->id)->delete(); parent::delete(); }
/** * Complete the item by adding a completed date * * @param int $list_id * @param int $item_id * @return Response */ public function complete($list_id, $item_id) { $item = TodoItem::findOrFail($item_id); $item->completed_on = date('Y-m-d H:i:s'); $item->update(); return Redirect::route('todos.show', $list_id)->withMessage("Item completed"); }
/** * Complete the item by adding a completed date. * * @param int $list_id * @param int $item_id * @return Response */ public function complete($list_id, $item_id) { $item = \App\TodoItem::findOrFail($item_id); $item->complete_on = date('Y-m-d H:i:s'); $item->update(); return redirect()->route('todos.show', $list_id)->withMessage('Item completed.'); }