@@ -32,7 +32,13 @@ class HomeController extends Controller
|
||||
setlocale(LC_TIME, 'fr_FR.utf8');
|
||||
$today = new DateTime();
|
||||
$user_id = Auth::user()->getAuthIdentifier();
|
||||
$posts = Post::where('user_id', $user_id)->orderBy('date_post', 'DESC')->get();
|
||||
$all_counts = Post::where('user_id', $user_id)->count();
|
||||
$year_counts = Post::where('user_id', $user_id)->count();
|
||||
$month_counts = Post::where('user_id', $user_id)
|
||||
->whereYear('date_post', $today->format('Y'))
|
||||
->whereMonth('date_post', $today->format('m'))->count();
|
||||
$image_counts = 0; // TODO #4
|
||||
$posts = Post::where('user_id', $user_id)->orderBy('date_post', 'DESC')->limit(9)->get();
|
||||
$today_post = Post::whereDate('date_post', '=', $today->format('Y-m-d'))
|
||||
->where('user_id', $user_id)
|
||||
->count();
|
||||
@@ -44,6 +50,10 @@ class HomeController extends Controller
|
||||
|
||||
return view('home', [
|
||||
'already' => $already,
|
||||
'all_counts' => $all_counts,
|
||||
'year_counts' => $year_counts,
|
||||
'month_counts' => $month_counts,
|
||||
'image_counts' => $image_counts,
|
||||
'today' => $today,
|
||||
'posts' => $posts,
|
||||
]);
|
||||
|
Reference in New Issue
Block a user