Skip to content

Commit

Permalink
Add isPublished to Post
Browse files Browse the repository at this point in the history
  • Loading branch information
dsbilling committed Mar 1, 2022
1 parent 72e8c9b commit 7205c3d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,8 @@ public function removeLike()
return false;
}

public function scopeIsPublished($query)
{
return $query->where('draft', false)->where('published_at', '<=', now());
}
}

0 comments on commit 7205c3d

Please sign in to comment.