File tree 8 files changed +74
-8
lines changed
8 files changed +74
-8
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## [ 0.10.2] - 2020-09-04
8
+ ### Added
9
+ - functionality to inject custom builder class for handling conflicting packages.
10
+
7
11
## [ 0.10.1] - 2020-08-02
8
12
### Fixed
9
13
- typos in test class.
@@ -307,7 +311,7 @@ Pushed changes intended for 0.5.1. Forgot to push changes to repo. 👀
307
311
308
312
## [ 0.3.3] - 10 Nov 2018
309
313
### Fixed
310
- - typo in method ` checkCooldownAndFlushAfterPersiting() ` to
314
+ - typo in method ` checkCooldownAndFlushAfterPersiting() ` to
311
315
` checkCooldownAndFlushAfterPersisting() ` ; thanks @jacobzlogar !
312
316
313
317
## [ 0.3.2] - 3 Nov 2018
Original file line number Diff line number Diff line change @@ -62,7 +62,28 @@ The following are packages we have identified as incompatible:
62
62
- [chelout/laravel-relationship-events](https://github.com/chelout/laravel-relationship-events)
63
63
- [spatie/laravel-query-builder](https://github.com/spatie/laravel-query-builder)
64
64
- [dwightwatson/rememberable](https://github.com/dwightwatson/rememberable)
65
- - [kalnoy/nestedset](https://github.com/kalnoy/nestedset)
65
+ - [kalnoy/nestedset](https://github.com/lazychaser/laravel-nestedset)
66
+
67
+ # ### Override
68
+ It may be possible to insert the custom querybuilder of the conflicting package
69
+ into this package by adding the following to your AppServiceProvider, in this
70
+ example we are implementing the NestedSet QueryBuilder:
71
+ ```php
72
+ //...
73
+ use GeneaLabs\LaravelModelCaching\ModelCaching;
74
+ use Kalnoy\Nestedset\QueryBuilder;
75
+
76
+ class AppServiceProvider extends ServiceProvider
77
+ {
78
+ public function boot()
79
+ {
80
+ ModelCaching::useBuilder(QueryBuilder::class);
81
+ //...
82
+ }
83
+
84
+ //...
85
+ }
86
+ ```
66
87
67
88
### Things That Don't Work Currently
68
89
The following items currently do no work with this package:
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <ruleset xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" name =" PHP_CodeSniffer" xsi : noNamespaceSchemaLocation =" phpcs.xsd" >
3
+ <description >GeneaLabs coding standards.</description >
4
+
5
+ <rule ref =" PSR1" ></rule >
6
+ <rule ref =" PSR2" ></rule >
7
+ <rule ref =" PSR12" >
8
+ <exclude name =" PSR12.Classes.ClassInstantiation.MissingParentheses" />
9
+ <exclude name =" PSR12.Functions.ReturnTypeDeclaration.SpaceBeforeColon" />
10
+ </rule >
11
+ </ruleset >
Original file line number Diff line number Diff line change 1
1
<?php namespace GeneaLabs \LaravelModelCaching ;
2
2
3
- use GeneaLabs \LaravelModelCaching \Traits \BuilderCaching ;
4
3
use GeneaLabs \LaravelModelCaching \Traits \Buildable ;
4
+ use GeneaLabs \LaravelModelCaching \Traits \BuilderCaching ;
5
5
use GeneaLabs \LaravelModelCaching \Traits \Caching ;
6
- use Illuminate \Database \Eloquent \Builder as EloquentBuilder ;
7
6
8
7
class CachedBuilder extends EloquentBuilder
9
8
{
Original file line number Diff line number Diff line change 1
- <?php namespace GeneaLabs \LaravelModelCaching ;
1
+ <?php
2
+
3
+ namespace GeneaLabs \LaravelModelCaching ;
2
4
3
5
use Illuminate \Container \Container ;
4
6
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace GeneaLabs \LaravelModelCaching ;
4
+
5
+ use Illuminate \Database \Eloquent \Builder ;
6
+
7
+ class ModelCaching
8
+ {
9
+ protected static $ builder = Builder::class;
10
+
11
+ public static function useEloquentBuilder (string $ builder ) : void
12
+ {
13
+ self ::$ builder = $ builder ;
14
+ }
15
+
16
+ public static function builder ()
17
+ {
18
+ return self ::$ builder ;
19
+ }
20
+ }
Original file line number Diff line number Diff line change 1
- <?php namespace GeneaLabs \LaravelModelCaching \Providers ;
1
+ <?php
2
+
3
+ namespace GeneaLabs \LaravelModelCaching \Providers ;
2
4
3
5
use GeneaLabs \LaravelModelCaching \Console \Commands \Clear ;
4
6
use GeneaLabs \LaravelModelCaching \Console \Commands \Publish ;
5
7
use GeneaLabs \LaravelModelCaching \Helper ;
8
+ use GeneaLabs \LaravelModelCaching \ModelCaching ;
6
9
use Illuminate \Support \ServiceProvider ;
7
10
8
11
class Service extends ServiceProvider
@@ -24,6 +27,13 @@ public function boot()
24
27
25
28
public function register ()
26
29
{
30
+ if (! class_exists ('GeneaLabs\LaravelModelCaching\EloquentBuilder ' )) {
31
+ class_alias (
32
+ ModelCaching::builder (),
33
+ 'GeneaLabs\LaravelModelCaching\EloquentBuilder '
34
+ );
35
+ }
36
+
27
37
$ this ->app ->bind ("model-cache " , Helper::class);
28
38
}
29
39
}
Original file line number Diff line number Diff line change 2
2
3
3
use GeneaLabs \LaravelModelCaching \CachedBelongsToMany ;
4
4
use GeneaLabs \LaravelModelCaching \CachedBuilder ;
5
- use Illuminate \Container \Container ;
6
- use Illuminate \Database \Eloquent \Builder as EloquentBuilder ;
5
+ use GeneaLabs \LaravelModelCaching \EloquentBuilder ;
7
6
use Illuminate \Database \Eloquent \Model ;
8
7
use Illuminate \Database \Eloquent \Relations \BelongsToMany ;
9
8
use Illuminate \Support \Carbon ;
You can’t perform that action at this time.
0 commit comments