Skip to content

Commit

Permalink
fix filter year on post.php
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyguy73 committed Oct 23, 2019
1 parent 3c72cc5 commit aef9320
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ public function scopeFilter($query, $filters)
$query->whereMonth('created_at', Carbon::parse($filters['month'])->month);
}

if($year = $filters['year']) {
$query->whereYear('created_at', $year);
// if($year = $filters['year']) {
// $query->whereYear('created_at', $year);
// }
if (isset($filters['year'])) {
$query->whereYear('created_at', $filters['year']);
}
}
public static function archives()
Expand Down

0 comments on commit aef9320

Please sign in to comment.