Skip to content

Commit

Permalink
take 20
Browse files Browse the repository at this point in the history
  • Loading branch information
daniieljc committed Apr 10, 2022
1 parent 68df510 commit f795064
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public function _invoke()
{
$topics = NewsTopic::all();
$now = Carbon::now();
$news = NewsLetter::whereDay('created_at', $now->format('d'))->whereYear('created_at', $now->format('Y'))->whereMonth('created_at', $now->format('m'))->orderBy('created_at', 'DESC')->get();
$news = NewsLetter::whereDay('created_at', $now->format('d'))->whereYear('created_at', $now->format('Y'))->whereMonth('created_at', $now->format('m'))->orderBy('created_at', 'DESC')->get()->take(20);
return view('home')->with('news', $news)->with('topics', $topics);
}

public function topic($id)
{
$topics = NewsTopic::all();
$now = Carbon::now();
$news = NewsLetter::where('news_topic_id', $id)->whereDay('created_at', $now->format('d'))->whereYear('created_at', $now->format('Y'))->whereMonth('created_at', $now->format('m'))->get();
$news = NewsLetter::where('news_topic_id', $id)->whereDay('created_at', $now->format('d'))->whereYear('created_at', $now->format('Y'))->whereMonth('created_at', $now->format('m'))->get()->take(20);
return view('topic')->with('news', $news)->with('topics', $topics)->with('topicid', $id);
}

Expand Down

0 comments on commit f795064

Please sign in to comment.