diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 18a0d08..b3130d1 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -26,6 +26,7 @@ class LoginController extends Controller * * @var string */ + protected $redirectTo = RouteServiceProvider::HOME; /** diff --git a/app/Http/Controllers/ChapterController.php b/app/Http/Controllers/ChapterController.php index 6c29d34..5c0fe80 100644 --- a/app/Http/Controllers/ChapterController.php +++ b/app/Http/Controllers/ChapterController.php @@ -49,7 +49,7 @@ class ChapterController extends Controller } else { //chapter number $manga = Manga::where('id', $request->manga_id)->first(); - $latestChap = $manga->chapters()->latest()->first()->chapter_no; + $latestChap = $manga->chapters()->orderBy('chapter_no', 'desc')->first()->chapter_no; $formData['chapter_no'] = $latestChap + 1; } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 703b14c..25ad20e 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,6 +2,8 @@ namespace App\Http\Controllers; +use App\Models\Manga; +use App\Models\User; use Illuminate\Http\Request; class HomeController extends Controller @@ -23,7 +25,11 @@ class HomeController extends Controller */ public function index() { - return view('home'); + $authors = User::where('role', 'author')->get(); + $users = User::where('role', 'user')->get(); + $mangas = Manga::all(); + // dd($authors); + return view('home', ['authors' => $authors, 'users'=> $users, 'mangas' => $mangas]); } diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index 0330d2b..b2cb3b2 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -26,11 +26,27 @@ class PageController extends Controller public function manga($slug) { $manga = Manga::where('slug', $slug)->first(); - return view('manga', compact('manga')); + $chapters = $manga->chapters()->orderBy('chapter_no', 'desc')->paginate(10); + $firstChapter = $manga->chapters()->orderBy('chapter_no', 'asc')->first(); + $lastChapter = $manga->chapters()->latest('chapter_no')->first(); + // dd($firstChapter); + return view('manga',[ + 'manga' => $manga, + 'chapters' => $chapters, + 'firstChapter' => $firstChapter, + 'lastChapter' => $lastChapter + ]); } public function chapter(Manga $manga, Chapter $chapter) { - return view('chapter_page', ['manga' => $manga, 'chapter' => $chapter]); + $firstChapter = $manga->chapters()->orderBy('chapter_no', 'asc')->first(); + $lastChapter = $manga->chapters()->latest('chapter_no')->first(); + return view('chapter_page', [ + 'manga' => $manga, + 'chapter' => $chapter, + 'firstChapter' => $firstChapter, + 'lastChapter' => $lastChapter + ]); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b6e0fe6..86b1719 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -20,6 +20,6 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { - Paginator::useBootstrap(); + Paginator::useBootstrapFive(); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 973b544..dd2524c 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -5,6 +5,7 @@ namespace App\Providers; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; @@ -17,7 +18,7 @@ class RouteServiceProvider extends ServiceProvider * * @var string */ - public const HOME = '/'; + public const HOME = "/"; /** * Define your route model bindings, pattern filters, and other route configuration. diff --git a/resources/sass/app.scss b/resources/sass/app.scss index f2d9bd0..a919e6d 100644 --- a/resources/sass/app.scss +++ b/resources/sass/app.scss @@ -22,3 +22,11 @@ .alert-msg { transform: translateX(-50%) translateY(10%); } + +.cover-img { + transition: all 1s; +} +.cover-img:hover { + filter: grayscale(30%); + transform: scale(1.2); +} diff --git a/resources/views/components/inner-manga.blade.php b/resources/views/components/inner-manga.blade.php index 2a4b474..e38bdd0 100644 --- a/resources/views/components/inner-manga.blade.php +++ b/resources/views/components/inner-manga.blade.php @@ -1,26 +1,43 @@ -@props(['manga']) +@props(['manga', 'chapters', 'firstChapter', 'lastChapter'])
{{ $manga->summary }}
{{ $manga->summary }}
Chapter {{ $chapter->chapter_no }} - {{ $chapter->title ?? '' }}
-- {{$chapter->updated_at->diffForHumans()}} -
- +Chapter {{ $chapter->chapter_no }} - {{ $chapter->title ?? '' }}
++ {{ $chapter->updated_at->diffForHumans() }} +
+ @emptyNo Chapter Yet!
@endforelseAuthors : {{ $authors->count() }} {{ Str::plural('author', $authors->count())}}
+Users : {{ $users->count() }} {{ Str::plural('user', $authors->count()) }}
+Comics : {{ $mangas->count() }} {{ Str::plural('comic', $mangas->count()) }}
{{ }}
--}} + class="btn btn-{{ $chapter->chapter_no == $lastChapter->chapter_no ? 'secondary' : 'dark' }} btn-small" + style="pointer-events: {{ $chapter->chapter_no == $lastChapter->chapter_no ? 'none' : '' }}"> Next{{ $hotManga->title }}
+{{ $hotManga->title }}
+ @foreach ($hotManga->chapters()->latest('id')->limit(2)->get() as $hotChap)