Skip to content

Commit

Permalink
Merge branch '1.x' of https://github.com/themsaid/wink into 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Aug 11, 2020
2 parents 0712f51 + 3352f83 commit 4f73e4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ php artisan wink:install
php artisan storage:link
```

**Configure the database connection** wink is going to be using in `config/wink.php`. The run:
**Configure the database connection** wink is going to be using in `config/wink.php`. Then run:

```sh
php artisan wink:migrate
Expand Down
14 changes: 14 additions & 0 deletions src/WinkPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,20 @@ public function scopeAfterPublishDate($query, $date)
return $query->where('publish_date', '>', $date);
}

/**
* Scope a query to only include posts that have a specific tag (by slug).
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $slug
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeTag($query, string $slug)
{
return $query->whereHas('tags', function ($query) use ($slug) {
$query->where('slug', $slug);
});
}

/**
* Prepare a date for array / JSON serialization.
*
Expand Down

0 comments on commit 4f73e4e

Please sign in to comment.