From 5edb495bcbfef105ce2da9ab45d902cb1bd6fca7 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Wed, 15 Feb 2017 18:39:39 +0000 Subject: [PATCH] Refactor method names/views for Notes --- app/Http/Controllers/NotesController.php | 14 +++++++------- .../{notes.blade.php => notes/index.blade.php} | 0 .../views/{note.blade.php => notes/show.blade.php} | 0 .../tagged.blade.php} | 0 routes/web.php | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) rename resources/views/{notes.blade.php => notes/index.blade.php} (100%) rename resources/views/{note.blade.php => notes/show.blade.php} (100%) rename resources/views/{taggednotes.blade.php => notes/tagged.blade.php} (100%) diff --git a/app/Http/Controllers/NotesController.php b/app/Http/Controllers/NotesController.php index f964e52e..bf222430 100644 --- a/app/Http/Controllers/NotesController.php +++ b/app/Http/Controllers/NotesController.php @@ -24,7 +24,7 @@ class NotesController extends Controller * @param Illuminate\Http\Request request; * @return \Illuminte\View\Factory view */ - public function showNotes(Request $request) + public function index(Request $request) { $notes = Note::orderBy('id', 'desc')->with('webmentions', 'place', 'media')->paginate(10); foreach ($notes as $note) { @@ -63,7 +63,7 @@ class NotesController extends Controller $homepage = ($request->path() == '/'); - return view('notes', compact('notes', 'homepage')); + return view('notes.index', compact('notes', 'homepage')); } /** @@ -72,7 +72,7 @@ class NotesController extends Controller * @param string The id of the note * @return \Illuminate\View\Factory view */ - public function singleNote($urlId) + public function show($urlId) { $numbers = new Numbers(); $authorship = new Authorship(); @@ -161,7 +161,7 @@ class NotesController extends Controller } $note->photoURLs = $photoURLs; - return view('note', compact('note', 'replies', 'reposts', 'likes')); + return view('notes.show', compact('note', 'replies', 'reposts', 'likes')); } /** @@ -170,7 +170,7 @@ class NotesController extends Controller * @param string The decimal id of he note * @return \Illuminate\Routing\RedirectResponse redirect */ - public function singleNoteRedirect($decId) + public function redirect($decId) { $numbers = new Numbers(); $realId = $numbers->numto60($decId); @@ -186,7 +186,7 @@ class NotesController extends Controller * @param string The tag * @return \Illuminate\View\Factory view */ - public function taggedNotes($tag) + public function tagged($tag) { $notes = Note::whereHas('tags', function ($query) use ($tag) { $query->where('tag', $tag); @@ -196,7 +196,7 @@ class NotesController extends Controller $note->human_time = $note->updated_at->diffForHumans(); } - return view('taggednotes', compact('notes', 'tag')); + return view('notes.tagged', compact('notes', 'tag')); } /** diff --git a/resources/views/notes.blade.php b/resources/views/notes/index.blade.php similarity index 100% rename from resources/views/notes.blade.php rename to resources/views/notes/index.blade.php diff --git a/resources/views/note.blade.php b/resources/views/notes/show.blade.php similarity index 100% rename from resources/views/note.blade.php rename to resources/views/notes/show.blade.php diff --git a/resources/views/taggednotes.blade.php b/resources/views/notes/tagged.blade.php similarity index 100% rename from resources/views/taggednotes.blade.php rename to resources/views/notes/tagged.blade.php diff --git a/routes/web.php b/routes/web.php index 2121becd..53873c38 100644 --- a/routes/web.php +++ b/routes/web.php @@ -93,10 +93,10 @@ Route::group(['domain' => config('url.longurl')], function () { Route::post('notes/new', 'MicropubClientController@postNewNote'); //Notes pages using NotesController - Route::get('notes', 'NotesController@showNotes'); - Route::get('note/{id}', 'NotesController@singleNoteRedirect'); - Route::get('notes/{id}', 'NotesController@singleNote'); - Route::get('notes/tagged/{tag}', 'NotesController@taggedNotes'); + Route::get('notes', 'NotesController@index'); + Route::get('notes/{id}', 'NotesController@show'); + Route::get('note/{id}', 'NotesController@redirect'); + Route::get('notes/tagged/{tag}', 'NotesController@tagged'); //indieauth Route::any('beginauth', 'IndieAuthController@beginauth');