Php 如何在Laravel中一个foreach循环中打印两个数组
我要在这个forech循环中打印这两个数组。如果我在提交后选中最后一项复选框,它将选中第一项未选中最后一项。这是我的问题Php 如何在Laravel中一个foreach循环中打印两个数组,php,arrays,foreach,laravel-blade,Php,Arrays,Foreach,Laravel Blade,我要在这个forech循环中打印这两个数组。如果我在提交后选中最后一项复选框,它将选中第一项未选中最后一项。这是我的问题 [dates:protected] => Array ( [0] => deleted_at ) [connection:protected] => mysql
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
这是我的代码示例图像
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
问题
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
我也在尝试其他问题的答案,但不适合我
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
提前感谢。我的刀片代码:
@elseif(isset($groupsData) && !$groupsData->isEmpty() or isset($qids) && !$qids->isEmpty())
<?php $i = 0; ?>
@foreach($groupsData as $key => $data)
<?php $i++; ?>
<tr>
<td><label><input type="checkbox" name="groups_id[]" value="{{ $data->id }}" class="check_checkbox" @if(isset($qids[$key]->group_id)) {{ 'checked' }} @endif ></label></td>
<td>{{ $i }}</td>
<td>{{ $data->group_name }}</td>
</tr>
@endforeach @else
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
(
[项目:受保护]=>阵列
(
[0]=>App\QuizGroupQuestionId对象
(
[可填充:受保护]=>阵列
(
[0]=>测验id
[1] =>组id
[2] =>问题编号
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
呈现的html代码:
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
<table class="table table-striped table-bordered table-hover table-responsive">
<thead>
<tr>
<th><label><input name="group_all" class="checked_all" type="checkbox"> Select All</label></th>
<th>#</th>
<th>Group Name</th>
</tr>
</thead>
<tbody>
<tr>
<td><label><input type="checkbox" name="groups_id[]" value="4" class="check_checkbox" checked ></label></td>
<td>1</td>
<td>jkl</td>
</tr>
<tr>
<td><label><input type="checkbox" name="groups_id[]" value="5" class="check_checkbox" checked ></label></td>
<td>2</td>
<td>mno</td>
</tr>
<tr>
<td><label><input type="checkbox" name="groups_id[]" value="7" class="check_checkbox" checked ></label></td>
<td>3</td>
<td>rthytr4y</td>
</tr>
<tr>
<td><label><input type="checkbox" name="groups_id[]" value="8" class="check_checkbox" ></label></td>
<td>4</td>
<td>erter</td>
</tr>
<tr>
<td><label><input type="checkbox" name="groups_id[]" value="9" class="check_checkbox" ></label></td>
<td>5</td>
<td>wetret</td>
</tr>
<tr>
<td><label><input type="checkbox" name="groups_id[]" value="10" class="check_checkbox" ></label></td>
<td>6</td>
<td>yhjjyukji</td>
</tr>
</tbody>
</table>
全选
#
组名
1.
jkl
2.
mno
3.
rthytr4y
4.
埃特
5.
韦特雷特
6.
yhjjyukji
好的,您可以看到所有单选按钮都已选中。您需要进行更好的检查。使用此检查,请根据刀片语法修复语法。但基本上您是在比较$qids中的组id和$data中的id
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
@if(isset($qids[$key]->group_id) && $qids[$key]->group_id == $data->$id ) {{ 'checked' }} @endif
我用两个php数组函数解决了问题。
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
这是我解决的代码:
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
@elseif(isset($groupsData) && !$groupsData->isEmpty() or isset($qids) && !$qids->isEmpty())
<?php
$i = 0;
$gids = array_column($qids->toArray(),'group_id');
?>
@foreach($groupsData as $key => $data)
<?php $i++; ?>
<tr>
<td><label>
<input type="checkbox" name="groups_id[]" value="{{ $data->id }}" class="check_checkbox" @if(in_array($data->id,$gids)) {{ 'checked' }} @endif >
</label></td>
<td>{{ $i }}</td>
<td>{{ $data->group_name }}</td>
</tr>
@endforeach
@else
@elseif(isset($groupsData)&&!$groupsData->isEmpty()或isset($qids)&&!$qids->isEmpty())
@foreach($groupsdataas$key=>$data)
id,$gids)){{‘选中’}}@endif>
{{$i}
{{$data->group_name}
@endforeach
@否则
屏幕截图:
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)
@elseif(isset($groupsData) && !$groupsData->isEmpty() or isset($qids) && !$qids->isEmpty())
<?php
$i = 0;
$gids = array_column($qids->toArray(),'group_id');
?>
@foreach($groupsData as $key => $data)
<?php $i++; ?>
<tr>
<td><label>
<input type="checkbox" name="groups_id[]" value="{{ $data->id }}" class="check_checkbox" @if(in_array($data->id,$gids)) {{ 'checked' }} @endif >
</label></td>
<td>{{ $i }}</td>
<td>{{ $data->group_name }}</td>
</tr>
@endforeach
@else
发布代码。不是图像OK@Andreas。我将添加。尝试为您的复选框inputdebug使用不同的id和类,方法是在html中回显$qids[$key]->group_id。您仅使用isset进行检查。是否还要基于$data->group_id==$qids[$key]->group_id检查?。除非你用不同的id和等级发布代码alsoHi@RAUSHANKUMAR try,否则我无法准确判断。但是没有任何改变。我不熟悉blade/laravel,但我可以告诉您如何调试。您可以进行打印($QID)。在这些代码块之前,查看$qids中的内容。您可以看到生成的html,其中radiobutton打印了“checked”。显示数组列表。你能告诉我如何在我的代码上方以这种方式检查复选框值吗?给我们你的呈现htmlHello@r4ccoon我正在用打印代码和呈现html代码更新我的问题ans,我正在使用html复选框而不是单选按钮。这就是为什么选中了多个输入。同样的问题,在选中最后一个复选框之后,会选中第一个复选框。您需要跟踪上次选中的id/提交的id。我能想到的最简单的方法就是把它放在url参数中。这个想法一旦提交,就会重定向到例如:page.php?last_checked_id=3,然后在radiobutton行中进行比较。如果($data->id=$\u GET['last\u checked\u id')有效,则需要使用laravel方法获取参数,使代码美观。然后再考虑一下由此导致的安全问题(如果有)。非常感谢您宝贵的回答。嗨@r4ccoon我已解决此问题并添加了这些代码。再次感谢您的帮助:)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 12
[quiz_id] => 1
[group_id] => 8
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[1] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 13
[quiz_id] => 1
[group_id] => 9
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
[2] => App\QuizGroupQuestionId Object
(
[fillable:protected] => Array
(
[0] => quiz_id
[1] => group_id
[2] => question_id
)
[dates:protected] => Array
(
[0] => deleted_at
)
[connection:protected] => mysql
[table:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[original:protected] => Array
(
[id] => 14
[quiz_id] => 1
[group_id] => 10
[question_id] =>
[created_at] => 2017-07-22 18:56:54
[updated_at] => 2017-07-22 18:56:54
[deleted_at] =>
)
[casts:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[forceDeleting:protected] =>
)
)