Skip to content

Commit 975a805

Browse files
committed
wire up article listing & pagination
1 parent 2234621 commit 975a805

File tree

2 files changed

+38
-52
lines changed

2 files changed

+38
-52
lines changed

resources/views/blog.blade.php

Lines changed: 32 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class="absolute -top-1/2 right-0 -z-20 h-60 w-60 rounded-full bg-violet-300/60 b
6464

6565
{{-- Blurred circle - Decorative --}}
6666
<div
67-
class="absolute left-0 top-1/2 -z-30 h-60 w-60 rounded-full bg-orange-200/60 blur-[150px] md:left-1/2 md:w-80 dark:bg-slate-500/50"
67+
class="absolute top-1/2 left-0 -z-30 h-60 w-60 rounded-full bg-orange-200/60 blur-[150px] md:left-1/2 md:w-80 dark:bg-slate-500/50"
6868
aria-hidden="true"
6969
></div>
7070
</header>
@@ -105,37 +105,15 @@ class="sr-only"
105105
"
106106
class="flex flex-col gap-5"
107107
>
108-
<x-article-card
109-
title="NativePHP for Desktop v1 is finally here!"
110-
url="/article"
111-
date="2025-04-09"
112-
>
113-
🎉 WE DID IT! We finally got to v1. I almost don't believe it!
114-
This is an awesome milestone. For a project that started as just
115-
an idea, to see it reach a truly stable place and support
116-
building powerful apps across all major platforms is just
117-
incredible.
118-
</x-article-card>
119-
<x-article-card
120-
title="Dropping Laravel 10 support"
121-
url="/article"
122-
date="2025-04-4"
123-
>
124-
Hey team, this is just a quick note about Laravel version
125-
support. Per our Support Policy matrix, we will be dropping
126-
Laravel 10 support for NativePHP for Desktop v1. Laravel 10
127-
reached end of life back in February 2025.
128-
</x-article-card>
129-
<x-article-card
130-
title="NativePHP for Mobile—Pricing update!"
131-
url="/article"
132-
date="2025-03-27"
133-
>
134-
Earlier this week I spoke at the Laravel Worldwide Meetup where
135-
I unveiled: 🌐 A brand new nativephp.com, lovingly (and
136-
painstakingly!) crafted by the incredible
137-
@HassanZahirnia
138-
</x-article-card>
108+
@foreach ($articles as $article)
109+
<x-article-card
110+
:title="$article->title"
111+
:url="route('article', $article)"
112+
:date="$article->published_at->format('Y-m-d')"
113+
>
114+
{{ $article->excerpt }}
115+
</x-article-card>
116+
@endforeach
139117
</div>
140118

141119
{{-- Pagination --}}
@@ -164,15 +142,17 @@ class="flex items-center justify-between gap-5 pt-2.5"
164142
"
165143
class="will-change-transform"
166144
>
167-
<a
168-
href="#"
169-
class="inline-block p-1.5 opacity-60 transition duration-200 hover:opacity-100"
170-
aria-label="Go to previous page"
171-
rel="prev"
172-
>
173-
<span class="sr-only">Navigate to</span>
174-
Previous
175-
</a>
145+
@if (! $articles->onFirstPage())
146+
<a
147+
href="{{ $articles->previousPageUrl() }}"
148+
class="inline-block p-1.5 opacity-60 transition duration-200 hover:opacity-100"
149+
aria-label="Go to previous page"
150+
rel="prev"
151+
>
152+
<span class="sr-only">Navigate to</span>
153+
Previous
154+
</a>
155+
@endif
176156
</div>
177157

178158
{{-- Next --}}
@@ -196,15 +176,17 @@ class="inline-block p-1.5 opacity-60 transition duration-200 hover:opacity-100"
196176
"
197177
class="will-change-transform"
198178
>
199-
<a
200-
href="#"
201-
class="inline-block p-1.5 opacity-80 transition duration-200 hover:opacity-100"
202-
aria-label="Go to next page"
203-
rel="next"
204-
>
205-
<span class="sr-only">Navigate to</span>
206-
Next
207-
</a>
179+
@if (! $articles->onLastPage())
180+
<a
181+
href="{{ $articles->nextPageUrl() }}"
182+
class="inline-block p-1.5 opacity-80 transition duration-200 hover:opacity-100"
183+
aria-label="Go to next page"
184+
rel="next"
185+
>
186+
<span class="sr-only">Navigate to</span>
187+
Next
188+
</a>
189+
@endif
208190
</div>
209191
</nav>
210192
</section>

routes/web.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use App\Http\Controllers\ShowDocumentationController;
4+
use App\Models\Article;
45
use Illuminate\Support\Facades\Route;
56
use Illuminate\Support\Str;
67

@@ -62,5 +63,8 @@
6263

6364
Route::get('/order/{checkoutSessionId}', App\Livewire\OrderSuccess::class)->name('order.success');
6465

65-
Route::view('blog', 'blog')->name('blog');
66-
Route::view('article', 'article')->name('article');
66+
Route::view('blog', 'blog', [
67+
'articles' => Article::latest()->paginate(6),
68+
])->name('blog');
69+
70+
Route::view('blog/{article}', 'article')->name('article');

0 commit comments

Comments
 (0)