@@ -19,10 +19,12 @@ This package has been tested with MySQL 5.7+ but others drivers should work as w
1919
2020## Features
2121
22- * Add a subquery based on a [query scope](https://laravel.com/docs/8.x/eloquent#query-scopes)
23- * Add a subquery using a Closure
24- * Support more than one subquery
25- * Zero third-party dependencies
22+ * Add a subquery based on a [query scope](https://laravel.com/docs/8.x/eloquent#query-scopes).
23+ * Add a subquery using a Closure.
24+ * Shortcuts for calling scopes by using a string or array.
25+ * Support for more than one subquery.
26+ * Support for flipping the result.
27+ * Zero third-party dependencies.
2628
2729## Support
2830
@@ -65,36 +67,35 @@ $posts = Post::addScopeAsSelect('is_published', function ($query) {
6567})->get();
6668```
6769
68- Using a string, where the second argument is the name of the scope:
70+ The example above can be shortened by using a string, where the second argument is the name of the scope:
6971```php
7072$posts = Post::addScopeAsSelect('is_published', 'published')->get();
7173```
7274
73- Using an array to call multiple scopes:
75+ You can use an array to call multiple scopes:
7476```php
7577$posts = Post::addScopeAsSelect('is_popular_and_published', ['popular', 'published'])->get();
7678```
7779
78- Using an associative array to call dynamic scopes:
80+ Use an associative array to call dynamic scopes:
7981```php
8082$posts = Post::addScopeAsSelect('is_announcement', ['ofType' => 'announcement'])->get();
8183```
8284
83- Using an associative array to call dynamic scopes with multiple arguments:
85+ If your dynamic scopes require multiple arguments, you can use an associative array :
8486```php
8587$posts = Post::addScopeAsSelect('is_announcement', ['publishedBetween' => [2010, 2020]])->get();
8688```
8789
88- Using an associative array to mix dynamic and non-dynamic scopes:
90+ You can also mix dynamic and non-dynmaic scopes:
8991```php
9092$posts = Post::addScopeAsSelect('is_published_announcement', [
9193 'published',
9294 'ofType' => 'announcement'
9395])->get();
9496```
9597
96- The method supports an optional third argument that flips the result.
97-
98+ The method has an optional third argument that flips the result.
9899```php
99100$posts = Post::addScopeAsSelect('is_not_announcement', ['ofType' => 'announcement'], false)->get();
100101```
0 commit comments