Loading app/Http/Controllers/NoteController.php +27 −11 Original line number Diff line number Diff line Loading @@ -13,27 +13,43 @@ class NoteController extends Controller public function GetAllNotes() { $notes=Note::select('id','updated_at','title','body')->where('user_id', Auth::id())->orderBy('updated_at','desc')->get(); $notes = Note::select('id', 'updated_at', 'title', 'body', 'new')->where('user_id', Auth::id())->orderBy('updated_at', 'desc')->get(); return Response()->json($notes, 200); } public function GetNote(Request $request, $id) { $note = Note::findorfail($id); if ($note->user_id != Auth::id()) return abort(403); return Response()->json($note); } public function ViewNoteEditor(Request $request, $id) { $note = Note::findorfail($id); if ($note->user_id != Auth::id()) return abort(403); return view('editnote', ['id' => $id]); } public function UpdateNote(Request $request, $id) { $note = Note::findorfail($id); if ($note->user_id != Auth::id()) return abort(403); $note->title = $request->title; $note->body = $request->body; $note->new=false; $note->save(); return Response()->json($note); } public function NewNote(Request $request) { $note = new Note; $note->user_id = Auth::id(); $note->new = true; $note->save(); return redirect()->route('note.edit.get', [$note->id]); } } database/migrations/2020_05_13_085805_create_notes_table.php +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ class CreateNotesTable extends Migration $table->foreign('user_id')->references('id')->on('users'); $table->text('title')->nullable(); $table->text('body')->nullable(); $table->boolean('new'); }); } Loading public/editormd/.gitignore 0 → 100644 +15 −0 Original line number Diff line number Diff line logs *.log *.pid *.seed node_modules/ .sass-cache/ research/ test/ backup/ examples/uploads/**/* *.bat *.sh .project .url css/*.map No newline at end of file public/editormd/.jshintrc 0 → 100644 +20 −0 Original line number Diff line number Diff line { "esnext": true, "bitwise": true, "camelcase": true, "curly": true, "eqeqeq": true, "immed": true, "indent": 4, "latedef": true, "newcap": true, "noarg": true, "quotmark": "double", "regexp": true, "undef": true, "unused": true, "strict": true, "trailing": true, "smarttabs": true, "white": true } No newline at end of file public/editormd/BUGS.md 0 → 100644 +22 −0 Original line number Diff line number Diff line #Bugs > 说明:删除线表示已经解决。 ####IE8 - ~~不能加载;~~ - flowChart(流程图)、sequenceDiagram(序列图)不支持IE8; - ~~不支持Markdown转HTML页面解析预览;~~ ####IE8 & IE9 & IE10 - KaTeX会出现解析错误,但不影响程序运行; ####Sea.js - ~~Raphael.js无法加载;~~ ####Require.js - ~~CodeMirror编辑器的代码无法高亮;~~ - ~~sequenceDiagram不支持: `Uncaught TypeError: Cannot call method 'isArray' of undefined.`~~ Loading
app/Http/Controllers/NoteController.php +27 −11 Original line number Diff line number Diff line Loading @@ -13,27 +13,43 @@ class NoteController extends Controller public function GetAllNotes() { $notes=Note::select('id','updated_at','title','body')->where('user_id', Auth::id())->orderBy('updated_at','desc')->get(); $notes = Note::select('id', 'updated_at', 'title', 'body', 'new')->where('user_id', Auth::id())->orderBy('updated_at', 'desc')->get(); return Response()->json($notes, 200); } public function GetNote(Request $request, $id) { $note = Note::findorfail($id); if ($note->user_id != Auth::id()) return abort(403); return Response()->json($note); } public function ViewNoteEditor(Request $request, $id) { $note = Note::findorfail($id); if ($note->user_id != Auth::id()) return abort(403); return view('editnote', ['id' => $id]); } public function UpdateNote(Request $request, $id) { $note = Note::findorfail($id); if ($note->user_id != Auth::id()) return abort(403); $note->title = $request->title; $note->body = $request->body; $note->new=false; $note->save(); return Response()->json($note); } public function NewNote(Request $request) { $note = new Note; $note->user_id = Auth::id(); $note->new = true; $note->save(); return redirect()->route('note.edit.get', [$note->id]); } }
database/migrations/2020_05_13_085805_create_notes_table.php +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ class CreateNotesTable extends Migration $table->foreign('user_id')->references('id')->on('users'); $table->text('title')->nullable(); $table->text('body')->nullable(); $table->boolean('new'); }); } Loading
public/editormd/.gitignore 0 → 100644 +15 −0 Original line number Diff line number Diff line logs *.log *.pid *.seed node_modules/ .sass-cache/ research/ test/ backup/ examples/uploads/**/* *.bat *.sh .project .url css/*.map No newline at end of file
public/editormd/.jshintrc 0 → 100644 +20 −0 Original line number Diff line number Diff line { "esnext": true, "bitwise": true, "camelcase": true, "curly": true, "eqeqeq": true, "immed": true, "indent": 4, "latedef": true, "newcap": true, "noarg": true, "quotmark": "double", "regexp": true, "undef": true, "unused": true, "strict": true, "trailing": true, "smarttabs": true, "white": true } No newline at end of file
public/editormd/BUGS.md 0 → 100644 +22 −0 Original line number Diff line number Diff line #Bugs > 说明:删除线表示已经解决。 ####IE8 - ~~不能加载;~~ - flowChart(流程图)、sequenceDiagram(序列图)不支持IE8; - ~~不支持Markdown转HTML页面解析预览;~~ ####IE8 & IE9 & IE10 - KaTeX会出现解析错误,但不影响程序运行; ####Sea.js - ~~Raphael.js无法加载;~~ ####Require.js - ~~CodeMirror编辑器的代码无法高亮;~~ - ~~sequenceDiagram不支持: `Uncaught TypeError: Cannot call method 'isArray' of undefined.`~~