Skip to content

Commit

Permalink
Fixed for laravel 9.35
Browse files Browse the repository at this point in the history
Laravel 9.35 introduced a PR which broke our way of dynamically defined
relationships (laravel/framework#44283). Use
laravel's own way `resolveRelationUsing` instead (introduced in laravel
7). Removed obsolete tentacles package
  • Loading branch information
tbruckmaier committed Jan 24, 2023
1 parent c7869ae commit 044bc8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"minimum-stability": "dev",
"require": {
"php": ">=7.0.0|^8.0",
"jgrossi/corcel": ">=2.5",
"p-andrey/tentacles": ">=1.2"
"jgrossi/corcel": ">=2.5"
},
"require-dev": {
"laravel/framework": ">=7.0",
"phpunit/phpunit": ">=6.0",
"orchestra/testbench": ">=3.4",
"orchestra/database": ">=3.4",
Expand Down
8 changes: 3 additions & 5 deletions src/AcfTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
*/
trait AcfTrait
{
// "Monkey-patching for eloquent models"
use EloquentTentacle;

protected static $acfRelations = [];

protected static function bootTraits()
Expand Down Expand Up @@ -49,8 +46,9 @@ public static function createAcfRelations()

// create a acf relation dynamically
$methodName = 'acf_' . $relationName;
self::addExternalMethod($methodName, function () use ($relationName, $config) {
return $this->hasAcf($relationName, $config);

self::resolveRelationUsing($methodName, function ($model) use ($relationName, $config) {
return $model->hasAcf($relationName, $config);
});
}
}
Expand Down

0 comments on commit 044bc8d

Please sign in to comment.