Skip to content

Commit e798bf4

Browse files
committed
💄 ajout de la landing page
1 parent b795e63 commit e798bf4

22 files changed

+79355
-141
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,38 @@
22

33
namespace App\Http\Controllers;
44

5+
use App\Models\Article;
6+
use App\Models\Thread;
57
use GuzzleHttp\Client;
68
use GuzzleHttp\Exception\GuzzleException;
79
use Illuminate\Http\Request;
10+
use Illuminate\Support\Facades\Cache;
811

912
class HomeController extends Controller
1013
{
1114
public function index()
1215
{
13-
return view('home');
16+
$latestArticles = Cache::remember('latestArticles', now()->addHour(), function () {
17+
return Article::with('tags')
18+
->orderByViews()
19+
->published()
20+
->trending()
21+
->limit(3)
22+
->get();
23+
});
24+
25+
$latestThreads = Cache::remember('latestThreads', now()->addHour(), function () {
26+
return Thread::whereNull('solution_reply_id')
27+
->whereBetween('threads.created_at', [now()->subMonth(), now()])
28+
->inRandomOrder()
29+
->limit(4)
30+
->get();
31+
});
32+
33+
return view('home', [
34+
'latestArticles' => $latestArticles,
35+
'latestThreads' => $latestThreads,
36+
]);
1437
}
1538

1639
public function slack(Request $request)

app/Providers/AppServiceProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use App\View\Composers\ModeratorsComposer;
1414
use App\View\Composers\TopContributorsComposer;
1515
use App\View\Composers\TopMembersComposer;
16+
use Carbon\Carbon;
1617
use Illuminate\Database\Eloquent\Relations\Relation;
1718
use Illuminate\Support\Facades\Blade;
1819
use Illuminate\Support\Facades\View;
@@ -39,6 +40,8 @@ public function register()
3940
public function boot()
4041
{
4142
date_default_timezone_set('Africa/Douala');
43+
setlocale(LC_TIME, 'fr_FR', 'fr', 'FR', 'French', 'fr_FR.UTF-8');
44+
Carbon::setLocale('fr_FR');
4245

4346
$this->bootMacros();
4447
$this->bootViewsComposer();

public/css/app.css

Lines changed: 9740 additions & 10 deletions
Large diffs are not rendered by default.

public/images/developer.png

1.01 MB
Loading

public/images/illustration.svg

Lines changed: 106 additions & 0 deletions
Loading

public/images/sponsors/gdg-douala.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)