skip to Main Content

Laravel syncWithoutDetaching with extra fields

I am trying to save a simple belongsToMany relation into my database. First, my table: Schema::create('user_activity_log', function (Blueprint $table) { $table->unsignedBigInteger('activity_id'); $table->unsignedBigInteger('log_id'); $table->unsignedInteger('sets'); $table->unsignedInteger('reps'); $table->primary(['activity_id', 'log_id']); $table->foreign('activity_id')->references('id')->on('user_activities') ->onDelete('cascade') ->onUpdate('cascade'); $table->foreign('log_id')->references('id')->on('user_logs') ->onDelete('cascade') ->onUpdate('cascade'); }); My Log and Activity models have these…

VIEW QUESTION
Back To Top
Search