mikebronner / laravel-model-caching

Eloquent model-caching made easy.
MIT License
2.26k stars 217 forks source link

BelongsToMany Doesn't Cache When Using Laravel Nova #278

Closed mikebronner closed 2 years ago

mikebronner commented 5 years ago

I just want to share my experinece with this issue. I just faced the BelongsToMany relationship issue using laravel and Nova. it doesn't update redis on save or update or create using Nova. I have to flush redis to see changes made by laravel nova. But when i use disableCache() on my models, it's working fine. But almost all my models using BelongsToMany relationships. So no point to use this package if it's not going to cache my models :) It might be related with the events between nova and models? Maybe this package doesn't regionise Nova events to trigger updates on redis.

Details about the issue: I got Work and Service models. It's many to many relationships. Work has many Services and Services has Many Works.

Models in project looks like: Work Model

class Work extends Model implements HasMedia
{
    use HasImage, HasTranslate, Cachable;

    public $translatable = ['client', 'project'];
    protected $collection = 'slider';

    protected $casts = [
        'date' => 'datetime',
    ];

    public function services()
    {
        return $this->belongsToMany(Service::class);
    }
}

Service Model

class Service extends Model
{
    use HasTranslate, HasSlug, Cachable;

    public $translatable = ['name', 'description'];

    public function getSlugOptions(): SlugOptions
    {
        return SlugOptions::create()
            ->generateSlugsFrom('name')
            ->saveSlugsTo('slug');
    }

    public function works()
    {
        return $this->belongsToMany(Work::class);
    }
}

Works table

    public function up()
    {
        Schema::create('works', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->json('client');
            $table->json('project');
            $table->date('date');
            $table->string('country');
            $table->string('url')->nullable();
            $table->timestamps();
        });
    }

Services table

    public function up()
    {
        Schema::create('services', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->json('name');
            $table->json('description');
            $table->string('slug')->unique();
            $table->string('icon');
            $table->timestamps();
        });
    }

Service Work pivot table

    public function up()
    {
        Schema::create('service_work', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('service_id')->unsigned();
            $table->integer('work_id')->unsigned();
        });
    }

Laravel : 5.8.30 Redis server v=5.0.5 Laravel Nova 2.0.9

I hope this help you to figure out the issue.

Update: I just notice the key names in redis is a bit weird.

xxx:tag:genealabs:laravel-model-caching:mysql:nemrut:appservice:key,

i believe there should be : between app and service so it should looks like

xxx:tag:genealabs:laravel-model-caching:mysql:nemrut:app:service:key,

is key naming working correctly? maybe shoud check that out.

Originally posted by @nemrutco in https://github.com/GeneaLabs/laravel-model-caching/issues/127#issuecomment-520214081

mikebronner commented 5 years ago

@nemrutco Let's continue the discussion here.

mikebronner commented 5 years ago

@tuseroni @nemrutco I have noticed that Nova doesn't necessarily fire the same events as Laravel when creating or saving resources. I think that may have something to do with it. Thanks for all the information, I will be looking into Nova compatibility. I just haven't been able to get to it yet. :)

AbanoubNassem commented 5 years ago

there is seek a problem with Clouser on saving with nova here is the error output :


     {
    "message": "Serialization of 'Closure' is not allowed",
    "exception": "Exception",
    "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php",
    "line": 65,
    "trace": [
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php",
            "line": 65,
            "function": "serialize"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php",
            "line": 121,
            "function": "put",
            "class": "Illuminate\\Cache\\FileStore",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Cache/Repository.php",
            "line": 355,
            "function": "forever",
            "class": "Illuminate\\Cache\\FileStore",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Cache/Repository.php",
            "line": 418,
            "function": "forever",
            "class": "Illuminate\\Cache\\Repository",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php",
            "line": 357,
            "function": "rememberForever",
            "class": "Illuminate\\Cache\\Repository",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/genealabs/laravel-model-caching/src/Traits/Buildable.php",
            "line": 292,
            "function": "__call",
            "class": "Illuminate\\Cache\\CacheManager",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/genealabs/laravel-model-caching/src/Traits/Buildable.php",
            "line": 227,
            "function": "retrieveCachedValue",
            "class": "GeneaLabs\\LaravelModelCaching\\CachedBelongsToMany",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/genealabs/laravel-model-caching/src/Traits/Buildable.php",
            "line": 97,
            "function": "cachedValue",
            "class": "GeneaLabs\\LaravelModelCaching\\CachedBelongsToMany",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php",
            "line": 588,
            "function": "get",
            "class": "GeneaLabs\\LaravelModelCaching\\CachedBelongsToMany",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php",
            "line": 429,
            "function": "getResults",
            "class": "Illuminate\\Database\\Eloquent\\Relations\\BelongsToMany",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php",
            "line": 401,
            "function": "getRelationshipFromMethod",
            "class": "Illuminate\\Database\\Eloquent\\Model",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php",
            "line": 333,
            "function": "getRelationValue",
            "class": "Illuminate\\Database\\Eloquent\\Model",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php",
            "line": 1546,
            "function": "getAttribute",
            "class": "Illuminate\\Database\\Eloquent\\Model",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Support/Arr.php",
            "line": 148,
            "function": "offsetExists",
            "class": "Illuminate\\Database\\Eloquent\\Model",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Support/helpers.php",
            "line": 162,
            "function": "exists",
            "class": "Illuminate\\Support\\Arr",
            "type": "::"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Fields/Field.php",
            "line": 253,
            "function": "data_get"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Fields/Field.php",
            "line": 234,
            "function": "resolveAttribute",
            "class": "Laravel\\Nova\\Fields\\Field",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php",
            "line": 60,
            "function": "resolve",
            "class": "Laravel\\Nova\\Fields\\Field",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php",
            "line": 176,
            "function": "Illuminate\\Support\\{closure}",
            "class": "Illuminate\\Support\\HigherOrderCollectionProxy",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php",
            "line": 61,
            "function": "each",
            "class": "Illuminate\\Support\\Collection",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/ResolvesFields.php",
            "line": 250,
            "function": "__call",
            "class": "Illuminate\\Support\\HigherOrderCollectionProxy",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/ResolvesFields.php",
            "line": 172,
            "function": "resolveFields",
            "class": "Laravel\\Nova\\Resource",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/ResolvesFields.php",
            "line": 183,
            "function": "updateFields",
            "class": "Laravel\\Nova\\Resource",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/FillsFields.php",
            "line": 35,
            "function": "updateFieldsWithoutReadonly",
            "class": "Laravel\\Nova\\Resource",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Http/Controllers/ResourceUpdateController.php",
            "line": 34,
            "function": "fillForUpdate",
            "class": "Laravel\\Nova\\Resource",
            "type": "::"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php",
            "line": 29,
            "function": "Laravel\\Nova\\Http\\Controllers\\{closure}",
            "class": "Laravel\\Nova\\Http\\Controllers\\ResourceUpdateController",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php",
            "line": 349,
            "function": "transaction",
            "class": "Illuminate\\Database\\Connection",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php",
            "line": 239,
            "function": "__call",
            "class": "Illuminate\\Database\\DatabaseManager",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Http/Controllers/ResourceUpdateController.php",
            "line": 43,
            "function": "__callStatic",
            "class": "Illuminate\\Support\\Facades\\Facade",
            "type": "::"
        },
        {
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Controllers\\ResourceUpdateController",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
            "line": 54,
            "function": "call_user_func_array"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
            "line": 45,
            "function": "callAction",
            "class": "Illuminate\\Routing\\Controller",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 219,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\ControllerDispatcher",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 176,
            "function": "runController",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 680,
            "function": "run",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 130,
            "function": "Illuminate\\Routing\\{closure}",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Http/Middleware/Authorize.php",
            "line": 18,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\Authorize",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Http/Middleware/BootTools.php",
            "line": 20,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\BootTools",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Http/Middleware/DispatchServingNovaEvent.php",
            "line": 20,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\DispatchServingNovaEvent",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php",
            "line": 43,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Http/Middleware/Authenticate.php",
            "line": 31,
            "function": "handle",
            "class": "Illuminate\\Auth\\Middleware\\Authenticate",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\Authenticate",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
            "line": 41,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php",
            "line": 75,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php",
            "line": 58,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Session\\Middleware\\AuthenticateSession",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",
            "line": 49,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
            "line": 56,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Session\\Middleware\\StartSession",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",
            "line": 37,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",
            "line": 66,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 105,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 682,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 657,
            "function": "runRouteWithinStack",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 623,
            "function": "runRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 612,
            "function": "dispatchToRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 176,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 130,
            "function": "Illuminate\\Foundation\\Http\\{closure}",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/nova/src/Http/Middleware/ServeNova.php",
            "line": 26,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Laravel\\Nova\\Http\\Middleware\\ServeNova",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php",
            "line": 65,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/fideloper/proxy/src/TrustProxies.php",
            "line": 57,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Fideloper\\Proxy\\TrustProxies",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
            "line": 62,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 171,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 105,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 151,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 116,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Volumes/Data/websites/testwebsite/public/index.php",
            "line": 55,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/abanoub/.composer/vendor/laravel/valet/server.php",
            "line": 158,
            "function": "require"
        }
    ]
}
mikebronner commented 5 years ago

@AbanoubNassem Thanks for the additional info! Currently this package is not Nova compatible, but it is definitely something we want to fix.

d8vjork commented 3 years ago

Is still this in progress? I think we're facing the same issue, any workaround for the Nova part only?

mikebronner commented 3 years ago

@d8vjork Hmm, was hoping the PR from @dmason30 would have fixed it. I need to get review a few other things and will rerun tests in the coming days. If you could submit a PR with a failing test, that would help me out tremendously.

d8vjork commented 3 years ago

@mikebronner Yeah, will definitely do once I've some time

olliescase commented 2 years ago

What's up with this? on v0.11.7 with laravel 8.83.18 & nova 3.32.0 we seem to be having issues where the opposite side of the relationship updates, however the side you're adding it from doesn't.

mikebronner commented 2 years ago

@olliescase happy to entertain a PR for this if you can. I currently don't use Nova in any of my projects. Unfortunately the other PR that was supposed to fix this was for Nova 4, and didn't work.

ekandreas commented 2 years ago

This is fixed in 0.12.5 saving pivot sync.

olliescase commented 2 years ago

Great! Will test it out on our project. Thanks @ekandreas for the heads up and @d8vjork for the fix. (And sorry @mikebronner for not responding - I had it in my head that I had)

mikebronner commented 2 years ago

Closing this issue for now.

JanKrb commented 2 years ago

Still having the same bug with nova 4.15 and package version 0.12.5. Anybody else here? When using functions such as detach using tinker or inside a controller, it seems to be working properly.