Add (news bites)

This commit is contained in:
2023-11-21 19:18:11 +08:00
parent 2e38a4120c
commit 3210563e42
37 changed files with 1581 additions and 153 deletions

View File

@@ -4,6 +4,7 @@
use App\Http\Controllers\Controller;
use App\Models\Post;
use App\Models\RssPost;
use Artesaos\SEOTools\Facades\SEOMeta;
use Artesaos\SEOTools\Facades\SEOTools;
use GrahamCampbell\Markdown\Facades\Markdown;
@@ -18,13 +19,15 @@ 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(3)->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(10)->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(10)->get();
return response(view('front.welcome', compact('featured_posts', 'latest_posts')), 200);
$rss_posts = RssPost::where('status', 'published')->orderBy('published_at', 'desc')->paginate(30);
return response(view('front.welcome', compact('rss_posts')), 200);
}
public function terms(Request $request)