Skip to content

Commit 9d9bb71

Browse files
committed
Merge branch 'master' into develop
2 parents 520418c + 286e069 commit 9d9bb71

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2360
-498
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@
55
/.gitignore export-ignore
66
/.scrutinizer.yml export-ignore
77
/.travis.yml export-ignore
8+
/build
9+
/composer.lock
10+
/database.yml export-ignore
811
/phpunit.xml export-ignore
912
/tests export-ignore
13+
/vendor

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve. Please fill out each section completely.
4+
5+
---
6+
7+
**Describe the bug**
8+
A clear and concise description of what the bug is.
9+
10+
**Eloquent Query**
11+
Please provide the complete eloquent query that caused the bug, for example:
12+
```php
13+
$model->with('otherModel')->get();
14+
```
15+
16+
**Stack Trace**
17+
The full stack trace from your log file.
18+
19+
**Environment**
20+
- PHP: [e.g. 7.1.0]
21+
- OS: [e.g. Ubuntu 18.04]
22+
- Laravel: [e.g. 5.6.15]
23+
- Model Caching: [e.g. 0.2.61]
24+
25+
**Additional context**
26+
Add any other context about the problem here.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
5+
---
6+
7+
**Is your feature request related to a problem? Please describe.**
8+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9+
10+
**Describe the solution you'd like**
11+
A clear and concise description of what you want to happen.
12+
13+
**Describe alternatives you've considered**
14+
A clear and concise description of any alternative solutions or features you've considered.
15+
16+
**Additional context**
17+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/build
12
/vendor
23
composer.lock

.travis.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
11
language: php
22

3-
env:
4-
-REDIS_HOST=127.0.0.1
3+
services:
4+
- postgresql
55

6-
php:
7-
- 7.1.3
8-
- 7.2
6+
matrix:
7+
include:
8+
- php: 7.1.3
9+
env: PU_FILE=57 REDIS_HOST=127.0.0.1
10+
- php: 7.1.3
11+
env: PU_FILE=56 REDIS_HOST=127.0.0.1
12+
- php: 7.1.3
13+
env: PU_FILE=55 REDIS_HOST=127.0.0.1
14+
- php: 7.1.3
15+
env: PU_FILE=54 REDIS_HOST=127.0.0.1
16+
- php: 7.2
17+
env: PU_FILE=57 REDIS_HOST=127.0.0.1
18+
- php: 7.2
19+
env: PU_FILE=56 REDIS_HOST=127.0.0.1
20+
- php: 7.2
21+
env: PU_FILE=55 REDIS_HOST=127.0.0.1
22+
- php: 7.2
23+
env: PU_FILE=54 REDIS_HOST=127.0.0.1
924

1025
services:
1126
- redis-server
1227

1328
before_script:
1429
- travis_retry composer self-update
1530
- travis_retry composer install --no-interaction --prefer-source
31+
- chmod +x tests/*.sh
32+
- psql -c 'create database testing;' -U postgres
1633

1734
script:
18-
- mkdir -p ./build/logs
19-
- ./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml
35+
- ./tests/pu-${PU_FILE}.sh
2036

2137
after_success:
2238
- travis_retry php vendor/bin/php-coveralls -v

CHANGELOG.md

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,100 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7-
## [0.2.51] - 51 Mar 2018
7+
## [0.3.2] - 3 Nov 2018
8+
### Added
9+
- handling of `whereJsonContains()` and `orWhereJsonContains()`.
10+
11+
### Fixed
12+
- price field value generation in BookFactory to not exceed database field limits.
13+
14+
## [0.3.1] - 7 Oct 2018
15+
### Changed
16+
- use of `cache()` helper method to `app("cache")` to allow for better Lumen compatibility. Thanks @nope7777!
17+
18+
### Updated
19+
- test script for Laravel 5.7 to use non-dev version of test dependency.
20+
21+
### Removed
22+
- `codedungeon/phpunit-result-printer` unit test output printer.
23+
24+
### Fixed
25+
- use of custom pagination name.
26+
- edge-case where tag creation failed.
27+
- usage of `forceDelete()` in the Builder.
28+
29+
## [0.3.0] - 10 Sep 2018
30+
### Added
31+
- Laravel 5.7 compatibility.
32+
33+
## [0.2.64] - 25 Jul 2018
34+
### Fixed
35+
- caching of subqueries of `->whereNotIn()` and `->whereIn()`.
36+
- nested where bindings.
37+
38+
## [0.2.63] - 9 Jun 2018
39+
### Fixed
40+
- where clause binding resolution issue.
41+
42+
## [0.2.62] - 1 Jun 2018
43+
### Fixed
44+
- function name typo.
45+
46+
### Removed
47+
- dump() used for debugging.
48+
49+
## [0.2.61] - 31 May 2018
50+
### Fixed
51+
- caching of paginated queries with page identifiers as arrays (`?page[size]=1`).
52+
53+
## [0.2.60] - 27 May 2018
54+
### Added
55+
- unit tests for multiple versions of Laravel simultaneously.
56+
- backwards-compatibility to Laravel 5.4.
57+
58+
## [0.2.59] - 27 May 2018
59+
### Fixed
60+
- caching of queries with `whereNotIn` clauses.
61+
62+
### Updated
63+
- readme to specify that lazy-loaded relationships are currently not cached.
64+
65+
## [0.2.58] - 24 May 2018
66+
### Fixed
67+
- caching of queries with `whereIn` clauses.
68+
69+
## [0.2.57] - 19 May 2018
70+
### Added
71+
- database name to cache keys and tags to help with multi-tenancy use-cases.
72+
73+
### Fixed
74+
- `find()` using array parameter.
75+
76+
## [0.2.56] - 12 May 2018
77+
### Fixed
78+
- nested `whereNull` within `whereHas`.
79+
80+
## [0.2.55] - 6 May 2018
81+
### Fixed
82+
- caching of `between` where clauses.
83+
- test cache keys and brought them back to green.
84+
85+
## [0.2.54] - 6 May 2018
86+
### Fixed
87+
- caching of query parameter bindings.
88+
89+
## [0.2.53] - 6 May 2018
90+
### Fixed
91+
- `->inRandomOrder()` to not cache the query.
92+
93+
## [0.2.52] - 21 Mar 2018
94+
### Changed
95+
- `flush` console command to be called `clear`, to match other laravel commands.
96+
97+
### Fixed
98+
- implementation of `count()` method.
99+
100+
## [0.2.51] - 10 Mar 2018
8101
### Added
9102
- disabling of `all()` query.
10103

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ for me, and one that would let me cache custom queries, as well as cache model
1717
relationships. This package is an attempt to address those requirements.
1818

1919
## Features
20-
- automatic, self-invalidating relationship (both eager- and lazy-loaded) caching.
20+
- automatic, self-invalidating relationship (only eager-loading) caching.
2121
- automatic, self-invalidating model query caching.
2222
- automatic use of cache tags for cache providers that support them (will
2323
flush entire cache for providers that don't).
2424

2525
## Requirements
2626
- PHP >= 7.1.3
27-
- Laravel >= 5.5
27+
- Laravel 5.4 - 5.7
28+
29+
### Possible Conflicting Packages
30+
Any packages that also override `newEloquentModel()` from the `Model` class will
31+
likely conflict with this package. So far these may include the following:
32+
- [grimzy/laravel-mysql-spatial](https://github.com/grimzy/laravel-mysql-spatial)
2833

2934
[![installation guide cover](https://user-images.githubusercontent.com/1791050/36356190-fc1982b2-14a2-11e8-85ed-06f8e3b57ae8.png)](https://vimeo.com/256318402)
3035

@@ -141,13 +146,17 @@ $results = $myModel->disableCache()->where('field', $value)->get();
141146
### Manual Flushing of Specific Model
142147
You can flush the cache of a specific model using the following artisan command:
143148
```sh
144-
php artisan modelCaching:flush --model=App\Model
149+
php artisan modelCache:clear --model=App\Model
145150
```
146151

147152
This comes in handy when manually making updates to the database. You could also
148153
trigger this after making updates to the database from sources outside your
149154
Laravel app.
150155

156+
## Possible Future Improvements
157+
- [caching of lazy-loaded relationships, see #127](https://github.com/GeneaLabs/laravel-model-caching/issues/127).
158+
- [caching of global scopes, see #106](https://github.com/GeneaLabs/laravel-model-caching/issues/106).
159+
151160
## Summary
152161
**That's all you need to do. All model queries and relationships are now
153162
cached!**

composer.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,25 @@
1010
],
1111
"require": {
1212
"fico7489/laravel-pivot": "*",
13-
"illuminate/cache": "5.5 - 5.6",
14-
"illuminate/config": "5.5 - 5.6",
15-
"illuminate/console": "5.5 - 5.6",
16-
"illuminate/database": "5.5 - 5.6",
17-
"illuminate/support": "5.5 - 5.6",
13+
"illuminate/cache": "5.4 - 5.7",
14+
"illuminate/config": "5.4 - 5.7",
15+
"illuminate/console": "5.4 - 5.7",
16+
"illuminate/database": "5.4 - 5.7",
17+
"illuminate/support": "5.4 - 5.7",
1818
"php": ">=7.1.3"
1919
},
2020
"require-dev": {
21-
"codedungeon/phpunit-result-printer": "*",
22-
"fzaninotto/faker": "~1.4",
23-
"mockery/mockery": "0.9.*",
24-
"orchestra/database": "3.6.x-dev@dev",
25-
"orchestra/testbench": "^3.6",
26-
"orchestra/testbench-browser-kit": "^3.6",
21+
"fzaninotto/faker": "*",
22+
"mockery/mockery": "*",
23+
"orchestra/database": "3.7.x-dev@dev",
24+
"orchestra/testbench-browser-kit": "3.7.*",
25+
"orchestra/testbench": "3.7.*",
2726
"php-coveralls/php-coveralls" : "*",
2827
"phpmd/phpmd": "*",
29-
"phpunit/phpunit": "*",
28+
"phpunit/phpunit": "7.*",
29+
"predis/predis": "*",
3030
"sebastian/phpcpd": "*",
31-
"symfony/thanks": "^1.0",
32-
"predis/predis": "^1.1"
31+
"symfony/thanks": "*"
3332
},
3433
"autoload": {
3534
"psr-4": {

database.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
test:
2+
adapter: postgresql
3+
database: testing
4+
username: homestead
5+
password: secret
6+
encoding: utf8

phpunit.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
convertErrorsToExceptions="true"
88
convertNoticesToExceptions="true"
99
convertWarningsToExceptions="true"
10-
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer"
1110
processIsolation="false"
1211
stopOnFailure="false"
13-
syntaxCheck="false"
1412
>
1513
<testsuites>
1614
<testsuite name="Feature">
@@ -33,5 +31,9 @@
3331
<env name="SESSION_DRIVER" value="array"/>
3432
<env name="QUEUE_DRIVER" value="sync"/>
3533
<env name="DB_CONNECTION" value="testing"/>
34+
<env name="DB_HOST" value="192.168.10.10"/>
35+
<env name="DB_DATABASE" value="testing"/>
36+
<env name="DB_USERNAME" value="homestead"/>
37+
<env name="DB_PASSWORD" value="secret"/>
3638
</php>
3739
</phpunit>

0 commit comments

Comments
 (0)