Update (kernel)
This commit is contained in:
@@ -22,15 +22,12 @@ protected function schedule(Schedule $schedule): void
|
||||
})->dailyAt('00:00');
|
||||
|
||||
$schedule->call(function () {
|
||||
$future_post = Post::whereNotNull('published_at')->where('status', 'future')->where('published_at', '<=', now())->orderBy('published_at', 'ASC')->first();
|
||||
$future_post = Post::whereNotNull('published_at')->where('status', 'future')->where('published_at', '>=', now())->orderBy('published_at', 'ASC')->first();
|
||||
|
||||
if (!is_null($future_post))
|
||||
{
|
||||
PublishIndexPostJob::dispatch($future_post->id)->onQueue('default')->onConnection('default');
|
||||
if (! is_null($future_post)) {
|
||||
PublishIndexPostJob::dispatch($future_post->id)->onQueue('default')->onConnection('default');
|
||||
}
|
||||
|
||||
|
||||
|
||||
})->everyMinute();
|
||||
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ public function home(Request $request)
|
||||
// $query->whereNotIn('id', [$featured_post?->id]);
|
||||
// })->where('status', 'publish')->orderBy('published_at', 'desc')->limit(5)->get();
|
||||
|
||||
$featured_posts = Post::where('status', 'publish')->where('published_at', '<=', now())->orderBy('published_at', 'desc')->limit(6)->get();
|
||||
$featured_posts = Post::where('status', 'publish')->where('published_at', '<=', now())->orderBy('published_at', 'desc')->limit(3)->get();
|
||||
|
||||
$latest_posts = Post::where(function ($query) use ($featured_posts) {
|
||||
$query->whereNotIn('id', $featured_posts->pluck('id')->toArray());
|
||||
})->where('status', 'publish')->where('published_at', '<=', now())->orderBy('published_at', 'desc')->limit(6)->get();
|
||||
})->where('status', 'publish')->where('published_at', '<=', now())->orderBy('published_at', 'desc')->limit(9)->get();
|
||||
|
||||
return response(view('front.welcome', compact('featured_posts', 'latest_posts')), 200);
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ public function index(Request $request)
|
||||
SEOTools::setTitle($title, false);
|
||||
|
||||
$posts = Post::with('category')->where('status', 'publish')
|
||||
->where('published_at', '<=', now())
|
||||
->orderBy('published_at', 'desc')
|
||||
->cursorPaginate(10) ?? collect();
|
||||
->where('published_at', '<=', now())
|
||||
->orderBy('published_at', 'desc')
|
||||
->cursorPaginate(10) ?? collect();
|
||||
|
||||
// breadcrumb json ld
|
||||
$listItems = [];
|
||||
@@ -124,10 +124,10 @@ public function category(Request $request, $category_slug)
|
||||
// Get the posts associated with these category IDs
|
||||
$postIds = PostCategory::whereIn('category_id', $categoryIds)->pluck('post_id');
|
||||
$posts = Post::whereIn('id', $postIds)
|
||||
->where('published_at', '<=', now())
|
||||
->where('status', 'publish')
|
||||
->orderBy('published_at', 'desc')
|
||||
->cursorPaginate(10);
|
||||
->where('published_at', '<=', now())
|
||||
->where('status', 'publish')
|
||||
->orderBy('published_at', 'desc')
|
||||
->cursorPaginate(10);
|
||||
|
||||
$title = $category->name.' News from FutureWalker';
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => ['web','horizonBasicAuth'],
|
||||
'middleware' => ['web', 'horizonBasicAuth'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
</header>
|
||||
</div>
|
||||
<div class="w-full bg-dark text-white d-none d-md-block">
|
||||
<div class="container-lg text-center py-2">
|
||||
@foreach ($categories as $category)
|
||||
<a href="#" class="text-white mx-3 font-family-roboto-condensed text-uppercase">{{ $category->name }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-lg text-center py-2">
|
||||
@foreach ($categories as $category)
|
||||
<a href="#"
|
||||
class="text-white mx-3 font-family-roboto-condensed text-uppercase">{{ $category->name }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,19 +9,19 @@
|
||||
|
||||
<article class="blog-post
|
||||
">
|
||||
<div class="mb-2">
|
||||
<h1 class="fw-bold font-family-roboto-condensed mb-1">{{ $post->title }}</h1>
|
||||
<div class="mb-2">
|
||||
<h1 class="fw-bold font-family-roboto-condensed mb-1">{{ $post->title }}</h1>
|
||||
|
||||
<div>
|
||||
@foreach ($post->keywords as $keyword)
|
||||
@if($keyword == $post->main_keyword)
|
||||
<span class="badge text-bg-dark me-1">{{ $keyword }}</span>
|
||||
@else
|
||||
<span class="badge text-bg-light border me-1">{{ $keyword }}</span>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@foreach ($post->keywords as $keyword)
|
||||
@if ($keyword == $post->main_keyword)
|
||||
<span class="badge text-bg-dark me-1">{{ $keyword }}</span>
|
||||
@else
|
||||
<span class="badge text-bg-light border me-1">{{ $keyword }}</span>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mb-2 text-secondary">
|
||||
|
||||
@@ -32,10 +32,16 @@
|
||||
class="rounded-4 card-img-top shadow" style="object-fit: cover;">
|
||||
</div>
|
||||
<div class="card-body px-0">
|
||||
<h3 class="h4 fw-bold font-family-roboto-condensed">
|
||||
<h3 class="h4 fw-bold font-family-roboto-condensed mb-0">
|
||||
<a
|
||||
href="{{ route('front.post', ['category_slug' => $post->category->slug, 'slug' => $post->slug]) }}">{{ $post->title }}</a>
|
||||
</h3>
|
||||
<div class="mb-0"><small
|
||||
class="text-secondary">{{ $post->published_at->diffForHumans() }}</small>
|
||||
<i class="bi bi-dot"></i>
|
||||
<small
|
||||
class="text-secondary">{{ markdown_min_read($post->body) }}</small>
|
||||
</div>
|
||||
<p>{{ str_first_sentence($post->bites) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -55,20 +61,20 @@ class="rounded-4 card-img-top shadow" style="object-fit: cover;">
|
||||
<div class="text-start">
|
||||
<h2 id="latest-news" class="fw-bold font-family-roboto-condensed mb-3 h2">Latest News</h2>
|
||||
</div>
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="row g-2 mb-4">
|
||||
@foreach ($latest_posts as $post)
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="card bg-white border-0 shadow" style="height:100%;">
|
||||
<div class="card-body d-flex">
|
||||
<div class="card-body d-flex p-2 p-lg-3">
|
||||
<div class="row align-self-center">
|
||||
<div class="col-12 col-lg-5 d-flex py-1" style="height:100%;">
|
||||
<div class="col-3 col-lg-5 d-flex py-1" style="height:100%;">
|
||||
<div class="align-self-center">
|
||||
<img class="img-fluid rounded-4" src="{{ $post->featured_image }}"
|
||||
<img class="img-fluid rounded-2" src="{{ $post->featured_image }}"
|
||||
alt="{{ $post->title }}">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-12 col-lg-7 d-flex py-1" style="height:100%;">
|
||||
<div class="col-9 col-lg-7 d-flex py-1" style="height:100%;">
|
||||
<div class="align-self-center">
|
||||
<div class="">
|
||||
<h3 class="h6 mb-0 fw-bold font-family-roboto-condensed">
|
||||
@@ -82,6 +88,9 @@ class="fw-bold"
|
||||
</div>
|
||||
<div><small
|
||||
class="text-secondary">{{ $post->published_at->diffForHumans() }}</small>
|
||||
<i class="bi bi-dot"></i>
|
||||
<small
|
||||
class="text-secondary">{{ markdown_min_read($post->body) }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user