File tree Expand file tree Collapse file tree 8 files changed +74
-8
lines changed Expand file tree Collapse file tree 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.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ 0.10.2] - 2020-09-04
8+ ### Added
9+ - functionality to inject custom builder class for handling conflicting packages.
10+
711## [ 0.10.1] - 2020-08-02
812### Fixed
913- typos in test class.
@@ -307,7 +311,7 @@ Pushed changes intended for 0.5.1. Forgot to push changes to repo. 👀
307311
308312## [ 0.3.3] - 10 Nov 2018
309313### Fixed
310- - typo in method ` checkCooldownAndFlushAfterPersiting() ` to
314+ - typo in method ` checkCooldownAndFlushAfterPersiting() ` to
311315 ` checkCooldownAndFlushAfterPersisting() ` ; thanks @jacobzlogar !
312316
313317## [ 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:
6262- [chelout/laravel-relationship-events](https://github.com/chelout/laravel-relationship-events)
6363- [spatie/laravel-query-builder](https://github.com/spatie/laravel-query-builder)
6464- [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+ ```
6687
6788### Things That Don't Work Currently
6889The 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 11<?php namespace GeneaLabs \LaravelModelCaching ;
22
3- use GeneaLabs \LaravelModelCaching \Traits \BuilderCaching ;
43use GeneaLabs \LaravelModelCaching \Traits \Buildable ;
4+ use GeneaLabs \LaravelModelCaching \Traits \BuilderCaching ;
55use GeneaLabs \LaravelModelCaching \Traits \Caching ;
6- use Illuminate \Database \Eloquent \Builder as EloquentBuilder ;
76
87class CachedBuilder extends EloquentBuilder
98{
Original file line number Diff line number Diff line change 1- <?php namespace GeneaLabs \LaravelModelCaching ;
1+ <?php
2+
3+ namespace GeneaLabs \LaravelModelCaching ;
24
35use Illuminate \Container \Container ;
46
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 ;
24
35use GeneaLabs \LaravelModelCaching \Console \Commands \Clear ;
46use GeneaLabs \LaravelModelCaching \Console \Commands \Publish ;
57use GeneaLabs \LaravelModelCaching \Helper ;
8+ use GeneaLabs \LaravelModelCaching \ModelCaching ;
69use Illuminate \Support \ServiceProvider ;
710
811class Service extends ServiceProvider
@@ -24,6 +27,13 @@ public function boot()
2427
2528 public function register ()
2629 {
30+ if (! class_exists ('GeneaLabs\LaravelModelCaching\EloquentBuilder ' )) {
31+ class_alias (
32+ ModelCaching::builder (),
33+ 'GeneaLabs\LaravelModelCaching\EloquentBuilder '
34+ );
35+ }
36+
2737 $ this ->app ->bind ("model-cache " , Helper::class);
2838 }
2939}
Original file line number Diff line number Diff line change 22
33use GeneaLabs \LaravelModelCaching \CachedBelongsToMany ;
44use GeneaLabs \LaravelModelCaching \CachedBuilder ;
5- use Illuminate \Container \Container ;
6- use Illuminate \Database \Eloquent \Builder as EloquentBuilder ;
5+ use GeneaLabs \LaravelModelCaching \EloquentBuilder ;
76use Illuminate \Database \Eloquent \Model ;
87use Illuminate \Database \Eloquent \Relations \BelongsToMany ;
98use Illuminate \Support \Carbon ;
You can’t perform that action at this time.
0 commit comments