diff --git a/app/Http/Controllers/InsightsController.php b/app/Http/Controllers/InsightsController.php index 14003e2c..1f56fb3b 100644 --- a/app/Http/Controllers/InsightsController.php +++ b/app/Http/Controllers/InsightsController.php @@ -3,17 +3,23 @@ namespace App\Http\Controllers; use App\Models\ExternalFeedItem; +use Illuminate\Http\Request; use Spatie\ContentApi\ContentApi; use Spatie\ContentApi\Data\Post; use Spatie\Feed\FeedItem; class InsightsController { - public function index() + public function index(Request $request) { - $insights = cache()->rememberForEver('insights', fn () => ContentApi::getPosts('ray', request('page', 1), theme: 'nord')); + $insights = ContentApi::getPosts( + product: 'ray', + page: request('page', 1), + perPage: 5, + theme: 'nord', + ); - if (request('page', 1)) { + if ($request->get('page', 1) === 1) { $highlight = $insights->first(); unset($insights[0]); @@ -21,8 +27,7 @@ public function index() $externalFeedItems = ExternalFeedItem::query() ->orderBy('created_at', 'desc') - ->limit(6) - ->get(); + ->paginate(7); return view('front.pages.insights.index', [ 'insights' => $insights, diff --git a/database/factories/ExternalFeedItemFactory.php b/database/factories/ExternalFeedItemFactory.php index 799910ef..4eb09cb0 100644 --- a/database/factories/ExternalFeedItemFactory.php +++ b/database/factories/ExternalFeedItemFactory.php @@ -11,6 +11,12 @@ public function definition(): array return [ 'title' => $this->faker->sentence(), 'url' => $this->faker->url(), + 'website' => $this->faker->randomElement([ + 'rias.be', + 'mailcoach.app', + 'flareapp.io', + 'sebastiandedeyne.com' + ]), 'short_summary' => $this->faker->sentence(), ]; } diff --git a/resources/images/backgrounds/blog-index.png b/resources/images/backgrounds/blog-index.png new file mode 100644 index 00000000..5287cf69 Binary files /dev/null and b/resources/images/backgrounds/blog-index.png differ diff --git a/resources/images/backgrounds/blog-post.png b/resources/images/backgrounds/blog-post.png new file mode 100644 index 00000000..a5ba8624 Binary files /dev/null and b/resources/images/backgrounds/blog-post.png differ diff --git a/resources/views/components/insights/list-item.blade.php b/resources/views/components/insights/list-item.blade.php index 98a5e041..edafd87a 100644 --- a/resources/views/components/insights/list-item.blade.php +++ b/resources/views/components/insights/list-item.blade.php @@ -1,31 +1,41 @@ -
-
- {{-- @todo Image --}} -
-
+ +
+ + +
+
+ @if ($insight->header_image) + + @endif +
+
+
-

- +

+ {{ $insight->title }}

- {!! $insight->summary !!} + + {!! $insight->summary !!} +
@isset($insight->date) - + @endisset - {{-- @todo Tags --}} -
    -
  • #postgresql
  • -
  • #backend
  • -
  • #databases
  • -
+ @if (count($insight->tags)) +
    + @foreach ($insight->tags as $tag) +
  • #{{ $tag }}
  • + @endforeach +
+ @endif

diff --git a/resources/views/front/pages/insights/index.blade.php b/resources/views/front/pages/insights/index.blade.php index 9f43b2cb..3019b1c4 100644 --- a/resources/views/front/pages/insights/index.blade.php +++ b/resources/views/front/pages/insights/index.blade.php @@ -1,4 +1,9 @@ - + Insights @@ -9,28 +14,44 @@ @endif - -

More insights

-
- @foreach($insights as $insights) - - @endforeach + +
+

More insights

+
+ @foreach($insights as $insight) + + @endforeach + +
+ @if ($insights->hasMorePages()) + + @endif
- + -

- From our team & products -

- - @foreach($externalFeedItems as $externalFeedItem) - @include('front.pages.insights.partials.externalFeedItem') - @endforeach - - View more - - + +
+

From our team & products

+
+ @foreach($externalFeedItems as $externalFeedItem) + @include('front.pages.insights.partials.externalFeedItem') + @endforeach +
+
+ @if ($externalFeedItems->hasMorePages()) + + @endif +
diff --git a/resources/views/front/pages/insights/partials/externalFeedItem.blade.php b/resources/views/front/pages/insights/partials/externalFeedItem.blade.php index f915387b..d62d9590 100644 --- a/resources/views/front/pages/insights/partials/externalFeedItem.blade.php +++ b/resources/views/front/pages/insights/partials/externalFeedItem.blade.php @@ -1,10 +1,14 @@
- - {{ $externalFeedItem->title }} + + {{ $externalFeedItem->title }} - diff --git a/resources/views/front/pages/insights/show.blade.php b/resources/views/front/pages/insights/show.blade.php index fb0cc779..4016f124 100644 --- a/resources/views/front/pages/insights/show.blade.php +++ b/resources/views/front/pages/insights/show.blade.php @@ -1,4 +1,4 @@ - + {{ $post->date?->format('d F Y') ?? 'Preview' }}

{{ $post->title }}

diff --git a/resources/views/livewire/newsletter.blade.php b/resources/views/livewire/newsletter.blade.php index 6c839d40..faf5731a 100644 --- a/resources/views/livewire/newsletter.blade.php +++ b/resources/views/livewire/newsletter.blade.php @@ -1,37 +1,42 @@ -