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