diff --git a/app/Http/Controllers/MangaChapterController.php b/app/Http/Controllers/MangaChapterController.php new file mode 100644 index 0000000..ff13bfc --- /dev/null +++ b/app/Http/Controllers/MangaChapterController.php @@ -0,0 +1,53 @@ +when(request()->has('search'), function($q) { + $keyword = request()->search; + $q->where('title', 'like', '%'.$keyword.'%'); + }) + ->latest('id') + ->paginate(8) + ->withQueryString(); + $hotMangas = Manga::with(['chapters']) + ->latest('id')->limit('3')->get(); + return view('index', ['mangas' => $mangas, 'hotMangas' => $hotMangas]); + } + + public function manga(Manga $manga) + { + $chapters = $manga->chapters() + ->latest('chapter_no') + ->paginate(10); + $hotMangas = Manga::with(['chapters']) + ->latest('id')->limit('3')->get(); + return view('manga',[ + 'manga' => $manga, + 'chapters' => $chapters, + 'hotMangas' => $hotMangas, + ]); + } + + public function chapter(Manga $manga,Chapter $chapter) + { + return view('chapter', [ + 'manga' => $manga, + 'chapter' => $chapter, + 'comments' => $chapter->comments()->latest('id')->get() + ]); + } + + public function select(Manga $manga, Request $request) + { + return redirect()->route('page.chapter', [$manga, $request->chapter_no]); + } +} diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index 0ea51c4..b528df1 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -2,53 +2,12 @@ namespace App\Http\Controllers; -use App\Models\Manga; -use App\Models\Chapter; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Storage; class PageController extends Controller { - public function index() + public function contact() { - // Storage::disk('local')->put('example.txt', 'Contents'); - $mangas = Manga::with(['chapters']) - ->when(request()->has('search'), function($q) { - $keyword = request()->search; - $q->where('title', 'like', '%'.$keyword.'%'); - }) - ->latest('id') - ->paginate(8)->withQueryString(); - $hotMangas = Manga::with(['chapters']) - ->latest('id')->limit('3')->get(); - return view('index', ['mangas' => $mangas, 'hotMangas' => $hotMangas]); - } - - public function manga(Manga $manga) - { - $chapters = $manga->chapters() - ->latest('chapter_no') - ->paginate(10); - $hotMangas = Manga::with(['chapters']) - ->latest('id')->limit('3')->get(); - return view('manga',[ - 'manga' => $manga, - 'chapters' => $chapters, - 'hotMangas' => $hotMangas, - ]); - } - - public function chapter(Manga $manga,Chapter $chapter) - { - return view('chapter_page', [ - 'manga' => $manga, - 'chapter' => $chapter, - 'comments' => $chapter->comments()->latest('id')->get() - ]); - } - - public function select(Manga $manga, Request $request) - { - return redirect()->route('page.chapter', [$manga, $request->chapter_no]); + return view('contact'); } } diff --git a/resources/views/chapter_page.blade.php b/resources/views/chapter.blade.php similarity index 100% rename from resources/views/chapter_page.blade.php rename to resources/views/chapter.blade.php diff --git a/resources/views/contact.blade.php b/resources/views/contact.blade.php new file mode 100644 index 0000000..e61552a --- /dev/null +++ b/resources/views/contact.blade.php @@ -0,0 +1,10 @@ +@extends('layouts.master') + + +@section('content') +

Contact Us

+
+

mangadex@gmail.com

+

09-xxxxxxxxx

+@endsection + diff --git a/resources/views/partials/discussion.blade.php b/resources/views/partials/discussion.blade.php index 5056b36..82c0f4e 100644 --- a/resources/views/partials/discussion.blade.php +++ b/resources/views/partials/discussion.blade.php @@ -3,7 +3,8 @@ @guest

You must Register or Login to post a Comment.

+ href="{{ route('login') }}" class="text-decoration-none">Login to post a Comment. +

@endguest @auth @@ -37,7 +38,9 @@ {{ $comment->user->name }} {{ $comment->created_at->diffForHumans() }}

-

{{ $comment->comment }}

+

+ {{ $comment->comment }} +

@include('partials.comment-edit-box') diff --git a/resources/views/partials/nav.blade.php b/resources/views/partials/nav.blade.php index 87a5429..8b28b90 100644 --- a/resources/views/partials/nav.blade.php +++ b/resources/views/partials/nav.blade.php @@ -13,7 +13,7 @@ HOME diff --git a/routes/web.php b/routes/web.php index ef70d4f..fb5d63d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,16 +1,15 @@ group(function () { +Route::controller(MangaChapterController::class)->group(function () { Route::get('/', 'index')->name('page.index'); Route::get('/MangaDex/manga/{manga:slug}', 'manga')->name('page.manga'); Route::get('/manga/{manga:slug}/chapter-{chapter:chapter_no?}', 'chapter') ->name('page.chapter'); Route::post('/{manga:slug}/chapter', 'select')->name('select.chapter'); }); +//contact page +Route::controller(PageController::class)->group(function(){ + Route::get('/contact', 'contact')->name('contact'); +}); //comment and reply Route::resource('comments', CommentController::class)->middleware('auth'); @@ -39,7 +42,7 @@ Route::resource('replies', ReplyController::class)->middleware('auth'); Auth::routes(); //home -Route::get('/home', [App\Http\Controllers\HomeController::class, 'index']) +Route::get('/home', [HomeController::class, 'index']) ->name('home'); //admin dashboard @@ -47,7 +50,6 @@ Route::middleware(['auth', 'admin.access'])->group(function () { Route::resource('manga', MangaController::class); Route::resource('chapter', ChapterController::class); - Route::get('/chapters/manage/{manga:slug}', [ChapterController::class, 'manage']) ->name('chapters.manage');