mirror of
https://github.com/HtetPhone/MangaDex.git
synced 2025-02-20 11:23:19 +08:00
tending to some details
This commit is contained in:
parent
e29ab0cde8
commit
38ad7e463a
53
app/Http/Controllers/MangaChapterController.php
Normal file
53
app/Http/Controllers/MangaChapterController.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Manga;
|
||||||
|
use App\Models\Chapter;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class MangaChapterController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$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', [
|
||||||
|
'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]);
|
||||||
|
}
|
||||||
|
}
|
@ -2,53 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Manga;
|
|
||||||
use App\Models\Chapter;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
|
|
||||||
class PageController extends Controller
|
class PageController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function contact()
|
||||||
{
|
{
|
||||||
// Storage::disk('local')->put('example.txt', 'Contents');
|
return view('contact');
|
||||||
$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]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
resources/views/contact.blade.php
Normal file
10
resources/views/contact.blade.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
@extends('layouts.master')
|
||||||
|
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h3 class="text-primary fw-semibold mt-5"><i class="bi bi-emoji-smile"></i> Contact Us </h3>
|
||||||
|
<hr class="w-50">
|
||||||
|
<p class="mt-3"> <i class="bi bi-envelope-at-fill text-primary"></i> mangadex@gmail.com</p>
|
||||||
|
<p class="mt-3"> <i class="bi bi-phone-vibrate-fill text-primary"></i> 09-xxxxxxxxx</p>
|
||||||
|
@endsection
|
||||||
|
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
@guest
|
@guest
|
||||||
<p class="text-black-50">You must <a href="{{ route('register') }}" class="text-decoration-none">Register</a> or <a
|
<p class="text-black-50">You must <a href="{{ route('register') }}" class="text-decoration-none">Register</a> or <a
|
||||||
href="{{ route('login') }}" class="text-decoration-none">Login</a> to post a Comment. </p>
|
href="{{ route('login') }}" class="text-decoration-none">Login</a> to post a Comment.
|
||||||
|
</p>
|
||||||
@endguest
|
@endguest
|
||||||
|
|
||||||
@auth
|
@auth
|
||||||
@ -37,7 +38,9 @@
|
|||||||
<span class="fw-bold text-primary"> <i class="bi bi-person-fill"></i> {{ $comment->user->name }}</span>
|
<span class="fw-bold text-primary"> <i class="bi bi-person-fill"></i> {{ $comment->user->name }}</span>
|
||||||
<span class="small text-black-50 fw-light ms-2"> {{ $comment->created_at->diffForHumans() }} </span>
|
<span class="small text-black-50 fw-light ms-2"> {{ $comment->created_at->diffForHumans() }} </span>
|
||||||
</p>
|
</p>
|
||||||
<p class="small mb-0"> {{ $comment->comment }} </p>
|
<p class="small mb-0">
|
||||||
|
{{ $comment->comment }}
|
||||||
|
</p>
|
||||||
<!-- comment edit box here -->
|
<!-- comment edit box here -->
|
||||||
@include('partials.comment-edit-box')
|
@include('partials.comment-edit-box')
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<a class="nav-link active" aria-current="page" href="{{ route('page.index') }}">HOME</a>
|
<a class="nav-link active" aria-current="page" href="{{ route('page.index') }}">HOME</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#">CONTACT US</a>
|
<a class="nav-link" href="{{route('contact')}}">CONTACT US</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Chapter;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use App\Http\Controllers\HomeController;
|
use App\Http\Controllers\HomeController;
|
||||||
use App\Http\Controllers\PageController;
|
|
||||||
use App\Http\Controllers\UserController;
|
use App\Http\Controllers\UserController;
|
||||||
use App\Http\Controllers\MangaController;
|
use App\Http\Controllers\MangaController;
|
||||||
use App\Http\Controllers\ReplyController;
|
use App\Http\Controllers\ReplyController;
|
||||||
use App\Http\Controllers\ChapterController;
|
use App\Http\Controllers\ChapterController;
|
||||||
use App\Http\Controllers\CommentController;
|
use App\Http\Controllers\CommentController;
|
||||||
use App\Http\Controllers\GenreController;
|
use App\Http\Controllers\GenreController;
|
||||||
|
use App\Http\Controllers\MangaChapterController;
|
||||||
|
use App\Http\Controllers\PageController;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -23,13 +22,17 @@ use App\Http\Controllers\GenreController;
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Route::controller(PageController::class)->group(function () {
|
Route::controller(MangaChapterController::class)->group(function () {
|
||||||
Route::get('/', 'index')->name('page.index');
|
Route::get('/', 'index')->name('page.index');
|
||||||
Route::get('/MangaDex/manga/{manga:slug}', 'manga')->name('page.manga');
|
Route::get('/MangaDex/manga/{manga:slug}', 'manga')->name('page.manga');
|
||||||
Route::get('/manga/{manga:slug}/chapter-{chapter:chapter_no?}', 'chapter')
|
Route::get('/manga/{manga:slug}/chapter-{chapter:chapter_no?}', 'chapter')
|
||||||
->name('page.chapter');
|
->name('page.chapter');
|
||||||
Route::post('/{manga:slug}/chapter', 'select')->name('select.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
|
//comment and reply
|
||||||
Route::resource('comments', CommentController::class)->middleware('auth');
|
Route::resource('comments', CommentController::class)->middleware('auth');
|
||||||
@ -39,7 +42,7 @@ Route::resource('replies', ReplyController::class)->middleware('auth');
|
|||||||
Auth::routes();
|
Auth::routes();
|
||||||
|
|
||||||
//home
|
//home
|
||||||
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])
|
Route::get('/home', [HomeController::class, 'index'])
|
||||||
->name('home');
|
->name('home');
|
||||||
|
|
||||||
//admin dashboard
|
//admin dashboard
|
||||||
@ -47,7 +50,6 @@ Route::middleware(['auth', 'admin.access'])->group(function () {
|
|||||||
Route::resource('manga', MangaController::class);
|
Route::resource('manga', MangaController::class);
|
||||||
|
|
||||||
Route::resource('chapter', ChapterController::class);
|
Route::resource('chapter', ChapterController::class);
|
||||||
|
|
||||||
Route::get('/chapters/manage/{manga:slug}', [ChapterController::class, 'manage'])
|
Route::get('/chapters/manage/{manga:slug}', [ChapterController::class, 'manage'])
|
||||||
->name('chapters.manage');
|
->name('chapters.manage');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user