Checkboxlist relationship with additional column

CheckboxList::make('questions') // Relationship field ->relationship('questions', 'title') // Relationship to questions model ->pivotData([ 'question_order' => 1 ]) when i save data its save question_order is 1 to all pivot table data Question can i increase it by 1 for each entry?
2 Replies
bathishig
bathishigOP2w ago
Schema::create('exam_questions', function (Blueprint $table) { $table->id(); $table->string('exam_id')->onDelete('cascade'); $table->string('question_id')->onDelete('cascade'); $table->integer('question_order'); $table->timestamps(); }); my pivot table
Matthew
Matthew2w ago
I'd do that with a handler for the create, and then you can make it do whatever you want.

Did you find this page helpful?