Skip to content

Commit 17540fd

Browse files
author
Admin
committed
Add note in readme about this issue laravel/framework#51825
1 parent 0533115 commit 17540fd

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,55 @@ III.5. [Delete resource](#iii5-delete-resource)
4242

4343
## II. Start using it
4444

45+
**NOTE**
46+
47+
The lib contains a backward compatible fix for this issue https://github.com/laravel/framework/issues/51825
48+
49+
This will not cover the cases when the relation is instantiated in the model without calling the functions from the HasRelationship trait (or to be more precise, from HasCleverRelationships trait)!
50+
Those cases will still have this issue.
51+
52+
To cover also those cases, for example for HasManyThrough use in model anonymous class:
53+
54+
```php
55+
return new class (
56+
$query,
57+
$farParent,
58+
$throughParent,
59+
$firstKey,
60+
$secondKey,
61+
$localKey,
62+
$secondLocalKey,
63+
$this // this is crucial
64+
) extends HasManyThrough {
65+
public function __construct(
66+
Builder $query,
67+
Model $farParent,
68+
Model $throughParent,
69+
string $firstKey,
70+
string $secondKey,
71+
string $localKey,
72+
string $secondLocalKey,
73+
BaseModel $resourceModel
74+
) {
75+
$this->setConstraintsStaticFlag($resourceModel);
76+
77+
return parent::__construct(
78+
$query,
79+
$farParent,
80+
$throughParent,
81+
$firstKey,
82+
$secondKey,
83+
$localKey,
84+
$secondLocalKey
85+
);
86+
}
87+
};
88+
```
89+
4590
Register
91+
4692
\MacropaySolutions\LaravelCrudWizard\Providers\CrudProvider
93+
4794
\MacropaySolutions\LaravelCrudWizard\Http\Middleware\UnescapedJsonMiddleware::class in lumen or laravel.
4895

4996
Create a constant in your code

0 commit comments

Comments
 (0)