public function doNoteDelete($id) { $note = Notes::findOrFail($id); $note->remove(); return redirect('notes')->with('note_deleted', true); }
public function getNotes() { $notes = new Collection(); $note_ids = DB::table('notes')->select('notes.id')->join('notes_user', 'notes_user.notes_id', '=', 'notes.id')->where('notes.author_id', $this->id)->orWhere('notes_user.user_id', $this->id)->get(); foreach ($note_ids as $id) { $notes->push(Notes::findOrFail($id->id)); } return $notes; }